When I run 'npm run build' I get the following error
ERROR in build.js from UglifyJs Unexpected token: punc (() [build.js:11307,24]
The code that seems to be causing the issue is somewhere in the below code.
Note: When I remove methods: {} and created(){} the error is resolved. I have also tried removing one function at a time from these two code blocks and nothing works until I completely remove both full sets of code blocks.
I can empty the "methods" code block and completely remove the "created" code block and it builds fine as well.
Also I do not have any issue running 'npm run dev'.
export default {
data: function() {
return {
currentSlide: 1,
slides: [
'slideshow-slide-1.png',
'slideshow-slide-2.png',
'slideshow-slide-3.png'
],
slideInfo: [
{ title: 'Commercial Truck Parts Wholesaler', description: 'All makes trucks parts, components and acillary products' },
{ title: 'Quality and Name-Brand Products', description: 'Direct ship program with mix and match capabilities' },
{ title: 'Fleet, Part Distributor or Service Facility?', description: 'Contact us to improve your parts procurement processa and reduce your inventory' }
],
myTimer: 0
}
},
methods: {
autoRotateImages() {
this.myTimer = setInterval(function() {
if (this.currentSlide < 3) {
this.currentSlide += 1;
} else {
this.currentSlide = 1;
}
}.bind(this), 5000);
},
changeSlide(index) {
this.currentSlide = index;
clearInterval(this.myTimer);
this.autoRotateImages();
},
getImageUrl(slide) {
return '/dist/'+slide;
}
},
created() {
this.autoRotateImages();
}
}
EDIT: Using this in my webpack.config.js file
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015']
}