jwagner / simplex-noise.js

A fast simplex noise implementation in Javascript / Typescript.
MIT License
1.61k stars 130 forks source link

ENOENT Error #43

Closed cujarrett closed 2 years ago

cujarrett commented 2 years ago

What

Forgive me if I'm wrong but I am using this package in a create-react-app 5.0.0 and React 17.X.X setting and with simplex-noise 3.0.0 I recieve this error.

WARNING in ./node_modules/simplex-noise/dist/esm/simplex-noise.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/matt-jarrett/Developer/js-pollock/node_modules/simplex-noise/simplex-noise.ts' file: Error: ENOENT: no such file or directory, open '/Users/matt-jarrett/Developer/js-pollock/node_modules/simplex-noise/simplex-noise.ts'
 @ ./src/lib/create-renderer.js 6:0-41 15:22-34
 @ ./src/lib/index.js 8:0-50 28:25-39
 @ ./src/App.js 13:0-25 87:39-42
 @ ./src/index.js 8:0-27 11:38-41

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.65.0 compiled with 1 warning in 1864 ms

My use

import SimplexNoise from "simplex-noise"
...
export default (opt = {}) => {
  ...
  const simplex = new SimplexNoise(randFunc)
  ...
}

Am I doing something wrong?

I searched for simplex-noise.ts as it's referenced in the error and I see it in this package's package.json.

...
"source": "simplex-noise.ts",
...
jwagner commented 2 years ago

Interesting. The source property does not seem to have an official definition: https://docs.npmjs.com/cli/v8/configuring-npm/package-json

I think I've used it in the context of parceljs: https://parceljs.org/features/targets/#package.json%23source

Do you know what interpretation create-react-app (or I guess more specifically webpack?) has of that property? I can't find a reference to it in their documentation.

Judging from the tests it's safe to remove. Did you try if removing this attribute solves your problem?

cujarrett commented 2 years ago

Thanks for the feedback @jwagner , I appriciate it.

I can try to remove it locally and report back.

cujarrett commented 2 years ago

Same error, it renders the app but I am happy to help figure out what's going on if you have any ideas.

WARNING in ./node_modules/simplex-noise/dist/esm/simplex-noise.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/matt-jarrett/Developer/js-pollock/node_modules/simplex-noise/simplex-noise.ts' file: Error: ENOENT: no such file or directory, open '/Users/matt-jarrett/Developer/js-pollock/node_modules/simplex-noise/simplex-noise.ts'
 @ ./src/lib/create-renderer.js 6:0-41 15:22-34
 @ ./src/lib/index.js 8:0-50 28:25-39
 @ ./src/App.js 13:0-25 87:39-42
 @ ./src/index.js 8:0-27 11:38-41

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.65.0 compiled with 1 warning in 5381 ms
jwagner commented 2 years ago

@cujarrett I found the issue now. The fix is out in 3.0.1. Can you confirm that fixes it for you as well? :)

cujarrett commented 2 years ago

3.0.1 fixed it, thanks @jwagner 👍