rollup-plugin-uglify: Error transforming bundle with 'uglify' plugin
I have an Angular 2 sample app that’s bundle up with Rollup, but it throws an error when using this plugin. It says
Error transforming bundle with ‘uglify’ plugin: SyntaxError: Unexpected token: name (AppComponent).
This is how my rollup.config.s looks like
import rollup from 'rollup'
import nodeResolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';
export default {
entry: 'dist/app/main.js',
dest: 'dist/build.js', // output a single application bundle
sourceMap: false,
format: 'iife',
plugins: [
nodeResolve({ jsnext: true, module: true }),
commonjs({
namedExports: {
// left-hand side can be an absolute path, a path
// relative to the current directory, or the name
// of a module in node_modules
'node_modules/primeng/primeng.js': ['DialogModule']
},
include: ['node_modules/rxjs/**', 'node_modules/primeng/**']
}),
uglify()
]
}
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 15
- Comments: 24 (8 by maintainers)
@LuisSevillano
yarn upgrade-interactive --latest@TrySound I think you can safely close this issue as you have it documented in https://github.com/TrySound/rollup-plugin-uglify#warning
Just a quick update from me, I have this working now which is awesome, since installing the harmony branch via the
npm i mishoo/UglifyJS2#harmony@dotnetCarpenter i think its better to use either
npm un uglify-jsornpm uninstall uglify-jsrather than deleting the folder manually 👍npm i mishoo/UglifyJS2#harmony
@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? It doesn’t work out of the box.
I guess that’s because of es2015 in dependencies code. Uglify supports only es5.