Running yarn build works fine, but running yarn build:production results in the following:
ERROR Failed to compile with 1 errors
error
scripts/main_29a38c72.js from UglifyJs
Unexpected token: name (w) [scripts/main_29a38c72.js:6671,4]
error Command failed with exit code 2.
I went through my js and think maybe its from using Swiper (http://idangero.us/swiper/)… but I need to use that module and am trying to figure out how to debug this in a more meaningful way. Anyone have any suggestions? As of now I have to deploy this site with a normal build
I’m wondering if I can build my production assets but maybe just disable Uglify for now… but I don’t know how to do that. Can anyone help with that at least?
I think Swiper must be doing something not allowed? Cause even trying to create an instance makes the build blow up. Or maybe its the eslint ignore rule cause it thinks I am defining a var I’m not using? Not sure.
I kind of feel like this is an uglify issue and not a webpack issue, since normal build works fine (that and the fact that the error clearly mentions UglifyJs). I want to try to change some UglifyJs options but can not figure out how to do so.
Here’s a minimal example:
yarn add swiper -d
the most minimal failure case is this main.js
import Swiper from 'swiper';
export default {
finalize() {
//eslint-disable-next-line
const swiper = new Swiper('.swiper-container');
},
};