无法使用webpack插件

时间:2018-03-15 07:39:01

标签: reactjs webpack

我正在使用安装了webpack-cli的webpack 4.7.0。这是一个react-js应用程序。这是我的webpack.config.js

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
  template: './client/index.html',
  filename: 'index.html',
  'inject': 'body'
});


module.exports = {
  entry: './client/index.js',
  output: {
    path: path.resolve('dist'),
    filename: 'bundle.js'
  },
  module: {
    rules: [
      { 
        test: /\.css$/,
        use: [
          { loader: "style-loader" },
          { loader: "css-loader" }
        ]
      },
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: "babel-loader"
      }
    ]
  }
  plugins: [HtmlWebpackPluginConfig]
}

现在,当我运行命令node_modules.bin \ webpack --config webpack.config.js时,收到以下错误消息:

  

插件:[HtmlWebpackPluginConfig]     ^^^^^^^

     

SyntaxError:意外的标识符

我无法构建我的应用程序。这是我的npm -v & node -v5.7.1 v9.4.0。我该如何解决这个问题?

0 个答案:

没有答案