-
Notifications
You must be signed in to change notification settings - Fork 83
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
Facing an issue when fflate.min.js is being bundled #51
Comments
I have found a workaround based on some threads facing similar issues with other modules using explicit /// instead of var e = {}, assign e to eval
function(_f){"use strict";var e=eval;...
///then... use the e to eval the require first
try{e("require('worker_threads')").Worker} It's not a big deal, but it will solve the issue with a minimum code change keeping compatibility with browser and bundle use. This thread gave me the clue, but specially this tweet |
Actually, I foresaw this issue and provided an unminified ESM build and an unminified CJS build to avoid the problem. I was hoping that nobody would ever use Webpack on the UMD build; it was meant specifically for direct users. Could you try replacing this line with a |
@jscastro76 Let me know if you have any issues after using the CJS build; I'll close this issue for now. If you find any further problems, I'll reopen it. |
I solved it in the way commented above, but surely more people bundling the fflate version of three.js will face that issue. I was thinking on moving to CJS so then I can come back to the original monitors version. |
Background
I'm maintaining Threebox, and I updated the repo to Three.js r127 which now uses
fflate
in many different loaders.The problem
The problem is that I'm finding issues to bundle
fflate.min.js
through different bundling tools, including browserify, webpack and vue-cli-service.How to reproduce
Using the file you provided to Three.js
fflate.min.js
, referenced from [FBXLoader
] that is also bundled in my plugin, and then bundlef with broserify or webpack (I have faced issues also with vue, but there could be ther more dependencies...) I get the following error every time I execute the bundle commands:browseryfy
:Webpack
:Alternatives
Some bundlers accept the option to ignore a reference to a module, but not all of them. I was guessing if you find an easy way to avoid this reference or make it conditional in the code. Any hint will be also greatly appreciated.
The text was updated successfully, but these errors were encountered: