【发布时间】:2018-09-29 09:04:24
【问题描述】:
我正在根据木偶指南使用 webpack 和 NPM 安装木偶。 我修改 webpack.config.js 如下:
var webpack = require('webpack');
module.exports = {
entry: './app/driver.js',
module: {
loaders: [
{
test: /\.html$/,
loader: 'underscore-template-loader'
}
]
},
output: {
path: __dirname + '/static/js',
filename: 'bundle.js'
},
plugins: [
new webpack.ProvidePlugin({
_: 'underscore'
})
],
resolve: {
modules: [__dirname + '/node_modules', __dirname + '/app']
},
resolveLoader: {
modules: [__dirname + '/node_modules']
}
};
但是在构建应用程序时,我遇到了错误:
配置对象无效。 Webpack 已使用与 API 模式不匹配的配置对象进行初始化。
- configuration.module 有一个未知的属性 'loaders'。这些属性是有效的:
object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, WrappedContextCritical?, WrappedContextRecursive?, WrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
-> 影响正常模块的选项 (NormalModuleFactory)。
您能帮忙解决这个错误吗?
【问题讨论】:
标签: webpack