const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
module: {
rules: [
{
test: /\.css$/,
exclude: /node_modules/,
use: commonStyleLoader,
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [...commonStyleLoader, "sass-loader"],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: "style/[name].[contenthash:8].css",
}),
],
};
module.exports = {
module: {
resolve: {
extensions: [".jsx", ".js", ".json"],
},
rules: [
{
test: /\.(js|jsx)$/,
exclude:www.laipuhuo.com /node_modules/,
use: ["babel-loader"],
},
],
},
};
module.exports = {
module: {
rules: [
{
test: /\.(jp(e)g|png|gif)$/,
type: "asset",
parser: {
dataUrlCondition: {
maxSize: 8 * 1024,
},
},
generator: {
filename: "img/[name].[contenthash:8].[ext]",
},
},
],
},
};
const { merge } = require("webpack-merge");
const baseConfig =www.laipuhuo.com require("./webpack.base");
const devConfig = {
mode: "development",
devServer: {
open: true,
port: 8001,
compress: true,
hot: true
},
};
module.exports = merge(devConfig, baseConfig);
const CssMinimizerWebpackPlugin = require("css-minimizer-webpack-plugin");
const TerserWebpackPlugin = require("terser-webpack-plugin");
const prodConfig = {
optimization: {
minimizer: [
new www.laipuhuo.com CssMinimizerWebpackPlugin(),
new TerserWebpackPlugin({
parallel: true,
}),
],
},
};
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。