在webpack.base.conf.js中的vue配置中加入
transpileOnly: true,
如下为完整配置:
{ test: /\.vue$/, loader: ‘vue-loader‘, options: { loaders: { ts: [ { loader: ‘ts-loader‘, options: { transpileOnly: true, appendTsSuffixTo: [/\.vue$/] } }], scss: [ ‘vue-style-loader!css-loader!sass-loader‘, // 全局sass变量 { loader: ‘sass-resources-loader‘, options: { // 需更改为项目中实际scss文件路径 resources: path.resolve(__dirname, ‘../src-mobile/styles/global.scss‘), }, }, ], // <style lang="scss"> sass: ‘vue-style-loader!css-loader!sass-loader‘ // <style lang="sass"> }, options: { esModule: true } } },