You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that vite does not provide nodejs polyfill by default.
Suggested solution
So, what if we make the build fail if we use nodejs modules? In cra, the build fails when using the fs module. But it doesn't fail with vite.
Some people apply polyfills, so how about giving an option like this: vite build no-polyfill
I think maybe a warning is enough instead of failing the build. Vite currently implements a mocked module for the builtin modules so that it emits a warning in runtime, maybe it make sense to surface it during build too.
Thanks for the reply. Thanks to vite, the development environment has improved.
I have introduced vite to an existing project that is quite large. And I'm not sure all the libraries I installed don't use nodejs built in modules. As explained in the official documentation, do not use nodejs built in modules in libraries. But like you said, I'd like to know if at least some library has this problem or not. @bluwy
bluwy
changed the title
Let build fail when using nodejs built in module
Warn on build when bundling code that uses nodejs built in module
Feb 18, 2023
Description
I understand that vite does not provide nodejs polyfill by default.
Suggested solution
So, what if we make the build fail if we use nodejs modules? In cra, the build fails when using the fs module. But it doesn't fail with vite.
Some people apply polyfills, so how about giving an option like this:
vite build no-polyfill
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: