Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webpack 模块生成失败:错误:“0”;“提取文本网页包插件”;导入.scss文件时_Webpack_Webpack Dev Server_Sass Loader_Extract Text Plugin_Extracttextwebpackplugin - Fatal编程技术网

Webpack 模块生成失败:错误:“0”;“提取文本网页包插件”;导入.scss文件时

Webpack 模块生成失败:错误:“0”;“提取文本网页包插件”;导入.scss文件时,webpack,webpack-dev-server,sass-loader,extract-text-plugin,extracttextwebpackplugin,Webpack,Webpack Dev Server,Sass Loader,Extract Text Plugin,Extracttextwebpackplugin,在react组件中导入.scss文件时发生此问题 package.json "scripts": { "dev": "source ./.env && nodemon server.js" }, "devDependencies": { "babel-core": "^6.26.0", "babel-loader": "^7.1.4", "babel-preset-env": "^1.6.1", "babel-preset-react": "^6.24.1"

在react组件中导入.scss文件时发生此问题

package.json

"scripts": {
  "dev": "source ./.env && nodemon server.js"
},
"devDependencies": {
  "babel-core": "^6.26.0",
  "babel-loader": "^7.1.4",
  "babel-preset-env": "^1.6.1",
  "babel-preset-react": "^6.24.1",
  "css-loader": "^0.28.11",
  "extract-text-webpack-plugin": "^4.0.0-beta.0",
  "nodemon": "^1.17.2",
  "sass-loader": "^6.0.7",
  "style-loader": "^0.20.3",
  "webpack": "^4.4.1",
  "webpack-dev-middleware": "^3.1.0",
  "webpack-dev-server": "^3.1.1"
}
webpack.config.js

module.exports = {
  mode: 'development',
  entry: './client/app/index.js',
  output: {
    path: `${__dirname}/dist`,
    publicPath: '/',
  },
  devtool: 'source-map',
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        include: `${__dirname}/client`,
        loader: 'babel-loader',
      },
      {
        test: /\.scss$/,
        loaders: [
          'style-loader',
          'css-loader',
          'sass-loader'
        ]
      }
    ]
  }
};
server.js

-----

if (process.env.NODE_ENV === 'development') {
  const compiler = webpack(webpackConf);
  app.use(webpackMiddleware(compiler, {
    publicPath: webpackConf.output.publicPath,
    contentBase: './client',
    hot: true,
    stats: {
      colors: true
    }
  }));
}
----
这是非常有线的。我不使用提取文本网页包插件

但问题在于它

我尝试将网页包降级到v3。但还是失败了


有人能帮我修一下吗…

。如果使用的是
sass加载器
,则需要使用此 根据github的建议

Second
规则。加载程序的配置错误。见

第三个
提取文本网页包插件
是网页包的依赖项