-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
TypeError: Illegal invocation on --minify-syntax #282
Comments
Hmm, it's hard to say. The only thing I can think of that could cause // file1.js
exports.rAF = requestAnimationFrame // file2.js
import {rAF} from './file1.js'
rAF(() => {}) With esbuild that would be bundled into something like this: var require_file1 = __commonJS((exports) => {
exports.rAF = requestAnimationFrame;
});
const file1 = __toModule(require_file1());
file1.rAF(() => {
}); I think this will cause var require_file1 = __commonJS((exports) => {
exports.rAF = requestAnimationFrame;
});
const file1 = __toModule(require_file1());
(0, file1.rAF)(() => {
}); I've known about the potential for this problem for a bit but I haven't ever observed it actually coming up in practice. If this is the issue, I can definitely fix it. But I can't see how that would be affected by minification, so that's probably not it. It'd be great to be able to reproduce this, even if it's not a minimal reproduction. I can do the minimizing myself if I can reproduce the issue. Edit: Wait, I just remembered something. Enabling |
Thanks @evanw for the quick reply. I am definitely mixing ES6 and CommonJS modules here. |
@evanw I have a (not so minified) reproduce case here https://github.com/ngbinh/esbuild-minify . Please let me know if you need anything |
Thanks for the reproduction case. It looks like it was a different but related issue. I'll push a fix for this sometime today. |
Wow, thanks |
is there a way for me to try the unreleased version? |
You can compile esbuild yourself if you'd like. Just download the repo and run |
thanks, will try the latest version out |
@evanw can verify that it fixes the problem in my repo. |
Thanks for confirming. This fix was just published in esbuild version 0.6.6. |
@evanw there seems to be a problem with pulling: |
What's the full error message? It probably says something like |
I downloaded the package through our own public nexus server. The link is https://nexus.anduin.co/repository/anduin-npm/esbuild/-/esbuild-0.6.6.tgz and you can see the binary is corrupted somehow |
Can you try again? I didn't realize registries can be hosted from non-root paths, so I added support for those in version 0.6.7. |
0.6.7 works for me. Thanks |
Hi,
I am using
esbuild
to bundle the output of a large scala.js program. With--minify-syntax
turned on, I seeTypeError: Illegal invocation
on various places. One on reactrequestAnimation
, another onconsole.log
. It is quite difficult to come up with a minimal reproduce. I am working on one but wonder if you have an idea on what to do.Thanks
The text was updated successfully, but these errors were encountered: