-
Notifications
You must be signed in to change notification settings - Fork 3
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
Bundling Issues with Vite #18
Comments
I'm not sure I understand your issue. ESM (browser and node.js) and CJS (just node.js) are distributed already bundled in the dist directory. Just use the one you need. Why do you need to rebuild? |
I don't remember the details on that, but I do know that I target CJS, so im not sure ESM would make sense. But the bigger issue is I don't like pre-bundled assets in node packages and you should be leaving it to the end developer to do that. That as a whole is my issue, as I cannot say if ESM would even help. Your package is in a minority that does it which is causing problems. Kudos. |
I certainly don't understand what you mean. I build the files and the package.json exports what is needed. You just need to install from npm.js and import/require the package, then the right one is used when you bundle your application. If the problem is that vite is not requiring/importing the right one, it may be an incompatibility with vite's bundler that I may analyse. Is it the case? |
Thats the problem. The files should not be pre-bundled to |
But you shouldn't build my library, you just need what is in the dist (distributable) directory. I have a complex build system to produce the distributables using the same source code. The original typescript sources along with a sourcemap file are provided just in case you need to debug and your debugger understands sourcemap files. |
Your missing the point. I don't want the library using a bundler at all and your in the minority of projects doing it. I would not need to fork if it was just plain js files and no post-processing. The pre-optimization you are doing IS the problem, it is breaking things because a bundler is trying to bundle pre-bundled code. That solution should not be fix the bundler but offer the un-bundled files in dist, either under main or as an export map. |
I seem to be getting issues with bundling in vite. The target is a webworker in
CJS
output.Issue is similar to #16.
I have so far fixed it by forking the repo and
bigint-mod-arith
and refactoring the build process to just output esm JS and not try to pre-bundle, so it can be processed normally.I would appreciate seeing that as I never really liked large minified js blobs in NPM packages.
Kudos.
The text was updated successfully, but these errors were encountered: