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

Impossible to use this package with ViteJS #1669

Closed
mquandalle opened this issue Jan 7, 2022 · 1 comment · Fixed by #1891
Closed

Impossible to use this package with ViteJS #1669

mquandalle opened this issue Jan 7, 2022 · 1 comment · Fixed by #1891

Comments

@mquandalle
Copy link

Is your feature request related to a problem? Please describe.
I'm migrating an app from Webpack 4 to ViteJS, but I'm blocked with the need to provide shims as described in the documentation for Webpack 5 :

{
  process: require.resolve('process/browser'),
  zlib: require.resolve('browserify-zlib'),
  stream: require.resolve('stream-browserify'),
  util: require.resolve('util'),
  buffer: require.resolve('buffer'),
  asset: require.resolve('assert'),
}

ViteJs uses Rollup under the hood (which make it possible to provide shims like in Webpack, although I'm not sure of the exact configuration needed there) but doesn't bundle in development mode, so it's not possible to have these shims in development.

Describe the solution you'd like
Make this package compatible with native ES Module, so that it doesn't require to configure a bundle/code transformation to use it.

I'm not an expert on the issue, but maybe it would be possible to import stream from a lib in the code, instead of using it as a global?

Describe alternatives you've considered
Find a way to implement shims in Rollup and ESBuild, but that seems excessively complex.

@mquandalle
Copy link
Author

Closing in favor of #1317 (comment)

@mquandalle mquandalle changed the title Impossible to use this package with VIteJS Impossible to use this package with ViteJS Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant