gpt4 book ai didi

Webpack 配置有一个未知属性 'preLoaders'

转载 作者:行者123 更新时间:2023-12-03 09:13:53 24 4
gpt4 key购买 nike

我正在从头开始学习 webpack。我已经学会了如何将 javascript 文件与 require 链接起来。我正在捆绑和缩小我的 js 文件,我正在用 watch 监听变化。我正在设置加载程序以将我的 sass 文件转换为 css。但是当我尝试使用 jshint-loader 设置 linting 过程时,我遇到了问题。

    module: {
preLoaders: [
{
test: /\.js$/, // include .js files
exclude: /node_modules/, // exclude any and all files in the node_modules folder
loader: "jshint-loader"
}
],

loaders: [
{
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules$/,
query: {
presets: ['es2015']
}
}
],

}

这是错误

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.module has an unknown property 'preLoaders'. These properties are valid: object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, loaders?, noParse?, rules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? } Options affecting the normal modules (NormalModuleFactory).

最佳答案

您显然正在尝试将 webpack v1 的示例与 webpack v2 一起使用。直接来自changelog :

  module: {
- preLoaders: [
+ rules: [
{
test: /\.js$/,
+ enforce: "pre",
loader: "eslint-loader"
}
]
}

关于Webpack 配置有一个未知属性 'preLoaders',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42476185/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com