webpack的插件extract-text-webpack-plugin报错unclosed string

webpack配置如下

const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
    entry: {/*  */
        index: './src/index/index.js',
        sally: './src/sally/sally.js'
    },
    output: {
        path: __dirname + '/dist',
        filename: '[name].js'
    },
    devServer: {
        contentBase: __dirname + '/dist',
        host: 'localhost',
        port: '8083',
        open: true,
    },
    module: {
        rules: [
          {
            test: /\.css$/,
            use: ExtractTextPlugin.extract({
                fallback: "style-loader",
                use: "css-loader"
              }),
          },
          {
            test: /\.(png|jpg|gif)$/i,
            use: ExtractTextPlugin.extract({
                fallback: "style-loader",
                use: "css-loader"
              })
          }
        ],
      },
    plugins: [
        new ExtractTextPlugin("index.css"),
        new CleanWebpackPlugin('./dist'),
        new HtmlWebpackPlugin({
            filename: 'index.html',
            template: './src/template.html',
            hash: true,
            // minify: {
            //     collapseWhitespace: true,
            // },
            title: 'hi there~',
            chunks: ['index']
        }),
        new HtmlWebpackPlugin({
            filename: 'sally.html',
            template: './src/template.html',
            hash: true,
            title: 'hi there~',
            chunks: ['sally']
        })
      ]

}/*  */

文件目录如下

clipboard.png

报错说是unclosed string 但是指向的文件却是个图片?!!我的webpack是4版本的,extract-text-webpack-plugin也是用的是最新版本。

clipboard.png

阅读 2.2k
1 个回答

自己粗心大意

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题