Implement minimizer for css/scss
This commit is contained in:
parent
9695064e82
commit
5f1dd09cb9
3 changed files with 555 additions and 28 deletions
|
@ -2,6 +2,7 @@ import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
|||
import fs from 'fs/promises';
|
||||
import HtmlWebpackPlugin from "html-webpack-plugin";
|
||||
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
||||
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
||||
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
|
||||
import path from "path";
|
||||
import sveltePreprocess from "svelte-preprocess";
|
||||
|
@ -79,33 +80,9 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
test: /\.(sc|c)ss$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{
|
||||
loader: "css-loader",
|
||||
options: {
|
||||
//url: false,
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
"sass-loader",
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{
|
||||
loader: "css-loader",
|
||||
options: {
|
||||
//url: false,
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
|
||||
},
|
||||
{
|
||||
test: /\.(html|svelte)$/,
|
||||
|
@ -185,6 +162,10 @@ module.exports = {
|
|||
extensions: [".tsx", ".ts", ".js", ".svelte"],
|
||||
mainFields: ["svelte", "browser", "module", "main"],
|
||||
},
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [new CssMinimizerPlugin(), "..."],
|
||||
},
|
||||
output: {
|
||||
filename: (pathData) => {
|
||||
// Add a content hash only for the main bundle.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue