SyntaxError: Unexpected token 'const' (with Vue, Karma, Webpack, PhantomJS)

前端 未结 3 974
天命终不由人
天命终不由人 2020-12-18 01:28

I have a more-or-less vanilla Laravel + Vue.js app and I am trying to do some JS testing with Karma and Jasmine. If I try to use () => {} style functions or

3条回答
  •  半阙折子戏
    2020-12-18 01:59

    In addition to RyanQuey's comment: he is right. The default Vue + Webpack CLI set-up only includes certain contexts to be handled by the babel-loader. Look into build/webpack.base.conf.js and then to the module rule for JS-files. You can see that only the src, test and node_modules/webpack-dev-server/client paths are included (at the time of this writing).

提交回复
热议问题