下面这些是我的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
版本问题 webpack版本与extract-text-webpack-plugin 不符合