代码拉取完成,页面将自动刷新
const path = require("path");
const ESLintWebpackPlugin = require("eslint-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
// 11513905206
module.exports = {
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
clean: true
},
module: {
rules: [
{
test: /.\css$/,
use: ['css-loader']
}
]
}
}
module.exports = {
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
clean: true,
},
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader/* "style-loader"*/, "css-loader", ]
},
{
test: /\.less$/,
use: [MiniCssExtractPlugin.loader/* "style-loader"*/, "css-loader", "less-loader", ]
},
// {
// test: /\.s[ac]ss$/,
// use: [MiniCssExtractPlugin.loader/* "style-loader"*/, "css-loader", "sass-loader", ]
// },
// {
// test: /\.styl$/,
// use: [MiniCssExtractPlugin.loader/* "style-loader"*/, "css-loader", "stylus-loader", ]
// },
{
test: /\.(png|jpe?g|gif|webp)/,
type: "asset",
parser: {
dataUrlCondition: {
maxSize: 10 * 1024
}
},
generator: {
filename: "static/imgs/[hash:8][ext][query]"
}
},
{
test: /\.(ttf|woff2?|mp4|mp3|avi)$/,
type: "asset/resource",
generator: {
filename: "static/media/[hash:8][etc][query]"
}
},
{
test: /.\js/,
exclude: /node_modules/,
loader: "babel-loader",
}
],
},
plugins: [
// new ESLintWebpackPlugin({
// context: path.resolve(__dirname, "src/js"),
// }),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "public/index.html"),
}),
new MiniCssExtractPlugin({
filename: "static/css/index.css"
}),
new CssMinimizerPlugin(),
],
devServer: {
host: "localhost",
port: "8889",
},
mode: "development",
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。