Closed hannah-wj-sky closed 4 years ago
What version of vue are you using? Did you use vue-cli or vite?
I tried replicating it on vue 2.6.11. project is generated by vue-cli 4.5.8, I was not having any problems. I'm guessing you're using vue 3? This package does not support vue 3 yet.
Hi, I found the solution here -
https://forum.vuejs.org/t/error-in-build-js-from-uglifyjs-unexpected-token-punc/33604/6
I had to install the 'uglifyjs-webpack-plugin' and then update the Uglify part of my webpack.config file.
npm i -D uglifyjs-webpack-plugin@1.3.0
Then:
Old code:
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
dead_code: true,
unused: true,
drop_console: true,
drop_debugger: true,
},
output: {
beautify: false,
}
})
New code:
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
....
new UglifyJsPlugin({
"uglifyOptions":
{
compress: {
warnings: false,
dead_code: true,
unused: true,
drop_console: true,
drop_debugger: true
},
output: {
beautify: false,
}
}
})```
Describe the bug The app runs great, exports pdfs but when I try to run 'npm run build' I get errors that are linked to the Uglify-js plugin that is a dependency of plugins which are dependencies of vue-html2pdf. So I won't be able to use it in production which is a real shame.
To Reproduce Steps to reproduce the behavior:
I then tried in a new app:
npm i vue-html2pdf
Package Version 1.8.0