运行npm run test-phantomjs
后,我收到以下错误:
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module.rules[1] should be an object.
- configuration.module.rules[2] should be an object.
这是我的webpack.config.test.js的样子:
const webpack = require('webpack');
const common = require('./webpack.config.common');
const metadata = require('./releaseMetadata');
const reactCssModules =
require('@infor/babel-plugin-react-css-modules').default;
module.exports = {
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: [
['es2015', { modules: false }],
'react',
],
plugins: [
'transform-object-rest-spread',
'lodash',
[reactCssModules, {
filetypes: {
'.scss': 'postcss-scss',
},
}],
],
},
},
common.cssRule,
common.imgRule,
common.svgRule,
],
},
resolve: common.resolve,
plugins: [
new webpack.DefinePlugin({
BUILD_DATE: metadata.BUILD_DATE,
BAMBOO_BUILD_NUMBER: metadata.BAMBOO_BUILD_NUMBER,
VERSION: '"test"',
}),
],
};
我在package.json中使用"webpack": "^3.8.1"
。有谁知道这个错误是什么?感谢。