-
Notifications
You must be signed in to change notification settings - Fork 42
Error transforming bundle with 'uglify' plugin #13
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
Comments
Having the same issue, were you able to resolve this? |
I guess that's because of es2015 in dependencies code. Uglify supports only es5. |
I also have this. My config is as follows, I am using the harmony branch though. // Rollup plugins
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-js';
export default {
entry: './app/scripts/framework/framework.js',
dest: './app/scripts/framework/framework.min.js',
format: 'iife',
moduleName: 'UIKit',
moduleContext: {
'./app/scripts/framework/parties/promise.js' : 'window',
'./app/scripts/framework/parties/fetch.js' : 'window'
},
plugins: [
babel({
exclude: ['./node_modules/**', './app/scripts/framework/parties/**'],
"presets": [[
"env", {
"targets": {
"chrome": 52
},
"modules": false
}
]],
"plugins": [
"external-helpers"
]
}),
uglify({}, minify)
]
}; I get this error Any help is much appreciated |
@TrySound Can you elaborate on how to, use the UglifyJS harmony branch by passing its minify function to minify your code, described in https://github.com/TrySound/rollup-plugin-uglify#warning? |
@dotnetCarpenter What's exactly doesn't work? |
@TrySound Uglify is not able to minify because of the es2015 syntax, when using the work-around, out of the box. I think we're all a bit clueless to how we can use the harmony branch of import uglify from 'rollup-plugin-uglify'
import { minify } from 'uglify-js'
...
export default {
entry: "js/src/main.js",
plugins: [
babel(babelrc()),
uglify({}, minify) Running the above through rollup gives me:
My
OS: Ubuntu 16.04 (Linux 4.4.0-53-generic) |
npm i mishoo/UglifyJS2#harmony |
@matt3224 @TrySound At first it didn't work after installing |
@TrySound Perhaps you should update the README with this as it's not apparent. |
@dotnetCarpenter PR welcome. |
Just a quick update from me, I have this working now which is awesome, since installing the harmony branch via the @dotnetCarpenter i think its better to use either |
same here
OS: Windows 10 |
@matt3224 I am using yarn and since uglify-js isn't in my dependency list but is a dependency of rollup-plugin-uglify, yarn won't let me uninstall uglify-js. Unfortunately, If I remember correctly, then When I |
Report an issue in yarn. |
@TrySound I know. But I'm pressed on time the next two weeks and got a lot of other priorities on my plate. I'll have to wait. But at least now, I'm not the only one with this information. ;) |
You may always use npm again. |
For me what it worked was: {
"devDependencies": {
"uglify-js": "git://github.com/mishoo/UglifyJS2#harmony"
}
} Instead of: npm i mishoo/UglifyJS2#harmony |
This worked for me:
|
Just a note to anyone coming to this issue a few months later. That So, either
Or
|
@aviddiviner harmony branch is released now as |
@TrySound I think you can safely close this issue as you have it documented in https://github.com/TrySound/rollup-plugin-uglify#warning |
Or even better, switch to use uglify-es instead of uglify-js as a dependency. |
For me what it worked was uninstall the plugin and install it again. |
@LuisSevillano |
I have an Angular 2 sample app that's bundle up with Rollup, but it throws an error when using this plugin. It says
This is how my rollup.config.s looks like
The text was updated successfully, but these errors were encountered: