-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPM Package raises "unexpected token ..." when building with webpack #22618
Comments
The JS code at the line shown is valid, so I think it's a matter of configuring Webpack as needed for modern JS features. Perhaps the "es2015" preset mentioned here will help? https://stackoverflow.com/questions/33460420/babel-loader-jsx-syntaxerror-unexpected-token |
Your version of webpack is really out of date. Version 1 is really, really old, so I would highly suggest updating your version of Webpack. The current version is 5. |
Closing as this seems to be a configuration issue. It appears to be more related to Webpack than to three.js, so Stack Overflow might be the best option, but if you do need help getting three.js to work on this project I'd recommend the forums (https://gltf-transform.donmccurdy.com), Slack, or Discord. |
This is because of line Is there no way to rewrite this to support older standards? I understand that 2015 is very old, most people don't need it anymore, but I'm asking just in case. |
I think it's okay to rewrite the code without the spread operator. |
Hm, we should identify the JavaScript version we are using, and ideally put in place tests to enforce it. Here we've removed a very common ES2018 feature, but in #23229 we're adding ES2020 features like optional chaining. In my opinion the published package should use modern (but not bleeding edge...) defaults, and let users transpile back to older browser compatibility if they need that support. Is it possible for DeepScan to warn us if we use features outside of ES2018, ES2020, or some other threshold? |
Agreed 👍
I don't think there is a way, but I bet they'll like to hear the feature request. |
Describe the bug
Building a react module with an import of three.js fails with the following error:
To Reproduce
Steps to reproduce the behavior:
npm install --save three
Code
Just importing the module leads to the error.
Live example
JSFiddle examples not included.
Expected behavior
The webpack should either work, since before adding in the three library the rest of react worked great with webpack, or it should raise an error tracable from my code.
Screenshots
Platform:
The text was updated successfully, but these errors were encountered: