webpack单独编译css文件时出现错误

下面这些是我的webpack配置信息

var htmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");

let pathsToClean = [
    'dist',
];


module.exports = {
    entry: './src/app.js',
    output: {
        path: __dirname + '/dist',
        filename: 'static/js/dozhan.[chunkhash].min.js',
    },
    plugins: [
        new htmlWebpackPlugin({
        template: './src/footer.html',
        hash: true,
        filename: "footer.html",
        minify: {
            collapseWhitespace: false
        }
    }),
        new CleanWebpackPlugin(pathsToClean),
        new ExtractTextPlugin("docs.min.css"),
    ],
    module: {
        rules: [
            {
                test: /\.css$/,

                use: ExtractTextPlugin.extract({
                    fallback: "style-loader",
                    use: "css-loader"
                })
            }
        ]
    },

};

这是我要编译的入口文件内容(app.js):

import 'docs'
import 'docs.min.css'
console.log('我是入口js文件');

这是我的目录结构
图片描述

问题来了,当我新增了 extract-text-webpack-plugin 插件想单独编译出css文件时 就出现了这样的提示,这是怎么回事?:

clean-webpack-plugin: C:\Users\Administrator\Desktop\web\dist has been removed.
(node:3592) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
(node:3592) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead
阅读 2.6k
1 个回答
新手上路,请多包涵

版本问题 webpack版本与extract-text-webpack-plugin 不符合

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