我的错误输出:
无效的配置对象。已使用与API模式不匹配的配置对象初始化Webpack。-configuration.module具有未知的属性“ loaders”。这些属性是有效的:对象{exprContextCritical?,exprContextRecursive?,exprContextRegExp?,exprContextRequest?,noParse ?、规则?,defaultRules?,unknownContextCritical?,unknownContextRecursive?,unknownContextRegExp?,unknownContextRequest?,unsafeCache?,wrappedContextCritical?,wrappedContextRecursive?,wrappedContextRegExpcursive? ?,strictExportPresence?,strictThisContextOnImports?}->影响普通模块的选项(
NormalModuleFactory
)。
我的webpack.config.js:
var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'src/client/public');
var APP_DIR = path.resolve(__dirname, 'src/client/app');
var config = {
entry: APP_DIR + '/index.jsx',
module : {
loaders : [
{
test : /\.jsx?/,
include : APP_DIR,
loader : 'babel-loader'
}
]
},
output: {
path: BUILD_DIR,
filename: 'bundle.js'
}
};
module.exports = config;
我的webpack版本:
webpack@4.1.1
rules
在webpack 4中。–