vue中引入swiper(4.0+),打包出错( ERROR in static/js/4.bafdba9a08bd02fd1c37.js from UglifyJs Unexpected toke)

vue打包报错: ERROR in static/js/4.bafdba9a08bd02fd1c37.js from UglifyJs Unexpected token: name (Dom7) [./~/[email protected]@dom7/dist/dom7.modular.js:16,0][static/js/4.bafdba9a08bd02fd1c37.js:853,6]

在build文件夹中的webpack.base.conf.js文件中,做如下修改:

alias: {
  'vue$': 'vue/dist/vue.common.js',
  'src': resolve('src'),
  'assets': resolve('src/assets'),
  'components': resolve('src/components'),
  '@': resolve('src'),
  'swiper': 'swiper/dist/js/swiper.js'

参考原文

2 如果因为某文件语法转换出错可以尝试
在build文件夹中的webpack.base.conf.js文件中,做如下修改:

{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'),resolve('node_modules/bootstrap-vue/lib')]
},

参考原文

你可能感兴趣的:(vue,webpack)