-
Notifications
You must be signed in to change notification settings - Fork 14
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
Error form UglifyJs #18
Comments
UglifyJS can't handle ES6 IIRC |
That's right Barney. @smuemd what bundler are you using? If rollup, then bss uses |
It's a webpack project with standard configuration via spike (https://github.com/static-dev/spike) @barneycarroll It's actually using ES6 all over the place. bss is the only package where this issue crops up. Emotion works fine for example. But who would want to use that? ;) |
Oh I see.. I just tried a clean install of spike, and it doesn't complain using bss there.. Is the project one you can share? Could you try to remove the node_modules folder package-lock.json and do npm install? |
@porsager with spike the js minification only takes place in production mode: $ npm run prod I got another hint: I just took the import b from './lib' minification worked without errors. Does Rollup give the files some special treatment? I am not too familiar with the tool. |
Ah sorry, didn't think about that.. I'm reproducing here now too.. I think webpack/babel skips transpiling modules that has a If I delete the |
Pointing main to bss.js and getting rid of the module declaration in package.json works too what is the module declaration good for anyway? |
For A side-effect which is nice is that you'll also get ES6 code directly instead of transpiled ES5 which makes sense in cases where you just want to run on ES6 supported clients. There's some more on the |
I'm actually curious I can't find anything more about this anywhere.. I don't see why it would make sense for them "not" to transpile the module entry point... |
interesting question indeed. I also tried the |
I think I'll keep this open until there's a resolution 😊 If you want to check in with webpack / spike, it's also good to refer here. I might also do that 😉 |
I think the issue lies in the transpilation step before uglify.js. It's only uglify.es that supports ES6 (also outputs ES6) |
I'm facing the problem using webpack before, looks like below two line: Cause For you own webpack config, solution is remove the exclude rule for babel-loader, but for spike, maybe you should dive into the API to find a way... |
Ah thanks a lot @futurist The thing that confuses me is that if I remove the module field and point main to the ES6 entry point it actually does transpile it 🧐 |
@porsager If you use
https://babeljs.io/docs/en/babel-preset-env.html#modules The source is here: Then follow into seems the plugin skip any I'm lost in Looks like Edit: I found some wrong thing for above, that |
@futurist good find! |
@smuemd I looked at the spike issue, and I wasn't sure if my understanding that webpack 4 doesn't have this problem is correct? In that case I also think it would be fine to close this issue.. |
I also faced the problem when using webpack@3, for Seems webpack 3 don't support |
Thanks @futurist .. Do you have an easy workaround for a case like that? Maybe
I hope this is resolved with Webpack 4, but I don't have time to test it right now.. |
Tested I have no issue again for webpack 3 when using Maybe can publish |
@futurist It works! Uglify is not complaining anymore. |
Hehe... When you're doing |
Ha. I had no idea. Thought |
Yeah that's what you would think, but webpack chooses to pick the |
Hello,
I am getting a strange error from UglifyJS.
Running this through webpack
Here is the error:
{ Error: 4.714f43602dc9cdd1454a.js from UglifyJs Unexpected token: operator (>) [4.714f43602dc9cdd1454a.js:29,12]
It points to this section in the bss code:
which looks fine.
I don't know what might cause this. The code works fine. It just wont minify.
The text was updated successfully, but these errors were encountered: