配置mocha-webpack以使用electron-webpack配置

时间:2018-11-16 03:22:57

标签: electron tdd mocha-webpack

我有以下脚本 mocha-webpack --require=tests/unit/setup.js tests/unit/**/*.spec.js 以及根目录下的以下webpack.config.js

const webpackRenderer = require('electron-webpack/webpack.renderer.config.js');

module.exports = env => {
  return new Promise((resolve, reject) => {
    /* get provided config */
    webpackRenderer(env).then(config => {
      /* return modified config to webpack */
      resolve(config)
    })
  })
};

当我检查/记录配置时,规则确实已经包含vue-loader,并且插件已经具有VueLoaderPlugin,但是当我运行脚本时,出现错误

Module parse failed: Unexpected token (1:0)
  You may need an appropriate loader to handle this file type.
  > <template>

指向mocha-webpack使用node_modules / electron-webpack / webpack.renderer.config.js下的配置会引发另一个错误

 Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property '_trace'. These properties are valid:

为此设置mocha-webpack的正确方法是什么?

0 个答案:

没有答案