mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-07-07 12:11:34 +00:00
improve webpack config
This commit is contained in:
parent
4d99a4616e
commit
10c34f25bd
3 changed files with 1645 additions and 131 deletions
1745
package-lock.json
generated
1745
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -2,7 +2,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"clean-webpack-plugin": "^4.0.0",
|
"clean-webpack-plugin": "^4.0.0",
|
||||||
"copy-webpack-plugin": "^9.0.1",
|
"copy-webpack-plugin": "^9.0.1",
|
||||||
"file-loader": "^6.2.0",
|
"css-minimizer-webpack-plugin": "^3.1.1",
|
||||||
"node-sass": "^6.0.1",
|
"node-sass": "^6.0.1",
|
||||||
"sass-loader": "^12.2.0",
|
"sass-loader": "^12.2.0",
|
||||||
"webpack": "^5.58.2",
|
"webpack": "^5.58.2",
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const CopyPlugin = require("copy-webpack-plugin");
|
const CopyPlugin = require("copy-webpack-plugin");
|
||||||
|
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
||||||
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
|
/** @type {import('webpack').Configuration} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: [path.resolve(__dirname, "./src/js/main.js"), path.resolve(__dirname, "./src/styles/main.scss")],
|
entry: [path.resolve(__dirname, "./src/js/main.js"), path.resolve(__dirname, "./src/styles/main.scss")],
|
||||||
output: {
|
output: {
|
||||||
|
|
@ -19,25 +21,36 @@ module.exports = {
|
||||||
{
|
{
|
||||||
test: /\.scss$/,
|
test: /\.scss$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
|
type: "asset/resource",
|
||||||
|
generator: {
|
||||||
|
filename: "user.css"
|
||||||
|
},
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: "file-loader",
|
loader: "sass-loader",
|
||||||
options: { name: "user.css" }
|
options: {
|
||||||
},
|
sourceMap: true
|
||||||
"sass-loader"
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
devtool: false,
|
devtool: "inline-source-map",
|
||||||
plugins: [
|
plugins: [
|
||||||
new CleanWebpackPlugin(),
|
new CleanWebpackPlugin({
|
||||||
|
protectWebpackAssets: false,
|
||||||
|
cleanAfterEveryBuildPatterns: ["*.LICENSE.txt"]
|
||||||
|
}),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
"process.env.DRIBBBLISH_VERSION": JSON.stringify((process.env.DRIBBBLISH_VERSION || "vDev").substring(1)) // Substring because the script expects the version to be `X.X.X` and not `vX.X.X`
|
"process.env.DRIBBBLISH_VERSION": JSON.stringify((process.env.DRIBBBLISH_VERSION || "vDev").substring(1)) // Substring because the script expects the version to be `X.X.X` and not `vX.X.X`
|
||||||
}),
|
}),
|
||||||
new webpack.SourceMapDevToolPlugin({}),
|
|
||||||
new CopyPlugin({
|
new CopyPlugin({
|
||||||
patterns: [{ from: "src/assets", to: "assets" }, { from: "src/color.ini" }]
|
patterns: [{ from: "src/assets", to: "assets" }, { from: "src/color.ini" }]
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
optimization: {
|
||||||
|
minimize: true,
|
||||||
|
minimizer: [`...`, new CssMinimizerPlugin()]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue