joshforisha / open-simplex-noise-js

OpenSimplex noise for TypeScript/JavaScript
The Unlicense
142 stars 21 forks source link

Cannot resolve './constants' #6

Closed jasminedevv closed 4 years ago

jasminedevv commented 4 years ago

I get the following webpack error when loading this module in a typescript project:

ERROR in ./node_modules/open-simplex-noise/lib/index.js
Module not found: Error: Can't resolve './constants' in '~/code/phaser-games/top-down-rpg/node_modules/open-simplex-noise/lib'
 @ ./node_modules/open-simplex-noise/lib/index.js 3:18-40
 @ ./src/GameScene.ts
 @ ./src/index.ts

This is the project template I'm using in case it's something wrong with my webpack/ts configs. I verified that you can reproduce the error by cloning this repo and trying to use the module. For example:

// GameScene.ts
import { makeNoise2D } from "open-simplex-noise"
const noise = makeNoise2D()
haack commented 4 years ago

Have had the same issue.

Looks like the build on npm is missing constants.js in lib. Would also be great to publish with the type definitions, which are already being generated.

You can work around this by building the project locally.

joshforisha commented 4 years ago

Sorry about that, the lib/ got omitted from the package's files array. v2.3.1 should fix this.

makeartandgames commented 3 years ago

I just hit this error with version 2.4 installed over npm

caught Error: Cannot find module './constants'
    at webpackMissingModule (index.js:4)
    at eval (index.js:4)
    at Object../node_modules/open-simplex-noise/lib/index.js (index.js:193)
    at __webpack_require__ (index.js:20)
    at eval (index.ts:5)
    at Module../src/index.ts (index.js:216)
    at __webpack_require__ (index.js:20)
    at index.js:84
    at index.js:87