-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Class constructor cannot be invoked without 'new' #6306
Comments
The underlying issue here is that the library you're using uses (untranspiled) Transpiling node_modules would also solve this: #1655
Yes. Somewhat related: #4879 |
would you recommend me to fix this in the package itself, or like you mentioned, transpile the node modules? I feel like this is more of an build / publish issue that should be fixed in the package. |
That's not possible with Parcel at the moment.
There's no single answer to that. The problem is that there is no standard at the moment to determine whether a npm package should be transpiled when building an application using it. And always publishing transpiled code even when you could use more modern syntax in your app isn't ideal either. |
`node_modules` can't be transpiled, see parcel-bundler#1655 and parcel-bundler#6306 (comment)
🐛 bug report
For my WebXR game, I'm migrating to parcel v2. However, I've ran into an issue with the Text component from the Drei. It uses troika-three-text internally.
I've setup a repro repo to showcase the issue. You can find that here: https://github.com/driescroons/parcelv2troika3dtext
When I serve my project, I get the following error:
Here is the location this error is thrown:
However, the weird thing is that when I build the project and use live-server to host the example, I don't get any issue:
It seems like whenever I'm serving, parcel is using the umd distributable, but when building, using the esm?
umd file from troika-3d-text:
esm file from troika-3d-text:
I've tried adding the browserslist flag to my package.json, but to no avail.
🎛 Configuration (.babelrc, package.json, cli command)
package.json
🤔 Expected Behavior
The serve command should work similar to the build command.
😯 Current Behavior
For some reason, the serve command, I think, uses the umd distributable file from troika-3d-text, while the build command uses the esm file.
💻 Code Sample
Reproduction repo
🌍 Your Environment
The text was updated successfully, but these errors were encountered: