Skip to content
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

Requiring node core module with trailing slash / ERROR #67

Closed
paro-paro opened this issue Dec 27, 2023 · 6 comments
Closed

Requiring node core module with trailing slash / ERROR #67

paro-paro opened this issue Dec 27, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@paro-paro
Copy link

paro-paro commented Dec 27, 2023

@davidmyersdev

My original post here

As pointed in the previous thread, seems like the plugin fails due to an upstream dependency trying to import process/ instead of process.

Doing some digging I detected that the conflicting dependency was readable-stream which is a NodeJS official package. Looks like the trailing slash / syntax is intended... as explained here.

Do not really understand the rationale behind it since it feels like a workaround for browserify...

In any case, it would be great if we can expect a fix from the plugin side.

Thanks a lot for your help!

@davidmyersdev davidmyersdev added the bug Something isn't working label Dec 27, 2023
@davidmyersdev
Copy link
Owner

@davidmyersdev
Copy link
Owner

This is fixed in v0.19.0.

Updated repro: https://stackblitz.com/edit/github-yd3jt3-9mmv9s?file=package.json

@paro-paro
Copy link
Author

paro-paro commented Jan 2, 2024

Hi @davidmyersdev

Thanks a lot for the quick fix. The trailing slash issue is indeed fixed in the new version. However, the nuxt production build is still failing for me with a different error from #41.

Now, the exports object seems to be injected in the final bundle, making the app crash on production.

Reproduction: https://stackblitz.com/edit/github-yd3jt3?file=nuxt.config.ts

  1. Running nuxt build and nuxt preview will return an "exports is not defined" error.

The reproduction uses nuxt 3.8.2 (which is the version I am currently using) but I have also tested the latest 3.9.0 release (which leverages vite 5.x) and no luck either.

Let me know if I could expect any help from the plugin side.

Thanks in advanced!

@paro-paro
Copy link
Author

Hi @davidmyersdev

Just posting here that I was able to fix my issue thanks to the awesome guys at nuxt. In the end, it was just a matter of targeting a different polyfill library in the aliasing property.

Here is some context in case you find it useful.

Thanks for the plugin!!

@pi0
Copy link

pi0 commented Jan 3, 2024

@davidmyersdev I would be more than happy to help if you like to migrate the polyfill backend to unenv, it should make the plugin much more usable.

@davidmyersdev
Copy link
Owner

Hey @pi0! I would love to migrate to unenv! I'll take a look and see if I have any questions for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants