Webpack定义插件原因:模块构建失败:错误:使用“extract-text-webpack-plugin”加载器而没有相应的插件

时间:2017-09-17 18:47:21

标签: javascript reactjs webpack

我正在尝试定义一个全局变量来定义我的react应用程序中的配置驱动流程。为此,我在我的webpack插件部分

中添加了以下definePlugin片段
new webpack.DefinePlugin({
    'MODE': JSON.stringify('SERVER_DEV')
})

一旦我这样做,我的构建开始失败抱怨

Module build failed: Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin

我对错误和原因如何相关有点无能为力。请注意,如果我删除此插件,def会恢复正常:)

这是我的webpack文件:

var path = require("path");
var fs = require("fs");
var webpack = require("webpack");
module.exports = {

module: {
  loaders: [
  {
    test: /\.jsx$/,
    loader: 'babel-loader',
    query: {
      cacheDirectory: true,
      presets: ['es2015']
    }
  }, {
    test: /\.css$/,
    loader: "style-loader!css-loader"
  },
  {
    test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
    loader: "url-loader!url-loader?limit=10000&mimetype=application/font-woff"
  }, {
    test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
    loader: "url-loader!url-loader?limit=10000&mimetype=application/font-woff"
  }, {
    test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
    loader: "url-loader!url-loader?limit=10000&mimetype=application/octet-stream"
  }, {
    test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
    loader: "url-loader!file-loader"
  }, {
    test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
    loader: "url-loader!url-loader?limit=10000&mimetype=image/svg+xml"
  }
 ]
},

entry: path.resolve(__dirname, './src/client/app.jsx'),

 resolve: {
 modules: ['node_modules',path.join(__dirname, "src"),],
     alias: {
   react: path.resolve('node_modules/react'),
 },
 extensions:[".js", ".jsx", ".json"]
},

plugins: [
 new webpack.ProvidePlugin({
   $: "jquery",
   jQuery: "jquery"
 })
 ,
 new webpack.DefinePlugin({
     'MODE': JSON.stringify('SERVER_DEV')
 })
 ],
};

知道这个错误试图告诉我什么?

0 个答案:

没有答案