Skip to content

Commit 627921b

Browse files
authored
Merge pull request #121 from vordgi/ncm-120
ncm-120 update classnames-minifier
2 parents 5fec1e0 + 9c6cd55 commit 627921b

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

package/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"css-loader": ">=4.0.0"
4545
},
4646
"dependencies": {
47-
"classnames-minifier": "0.2.2",
47+
"classnames-minifier": "1.0.0",
4848
"uuid": "10.0.0"
4949
}
5050
}

package/src/withClassnamesMinifier.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
import type { Configuration } from "webpack";
33
import type { Config } from "classnames-minifier/dist/lib/types/plugin";
44
import ClassnamesMinifier from "classnames-minifier";
5-
import injectConfig from "./lib/injectConfig";
65
import path from "path";
6+
import fs from "fs";
7+
8+
import injectConfig from "./lib/injectConfig";
79

8-
type PluginOptions = Omit<Config, "cacheDir" | "distDir"> & { disabled?: boolean };
10+
type PluginOptions = Omit<Config, "cacheDir" | "distDir" | "checkDistFreshness"> & { disabled?: boolean };
911

1012
let classnamesMinifier: ClassnamesMinifier;
1113

@@ -20,9 +22,12 @@ const withClassnameMinifier = (pluginOptions: PluginOptions = {}) => {
2022
classnamesMinifier = new ClassnamesMinifier({
2123
prefix: pluginOptions.prefix,
2224
reservedNames: pluginOptions.reservedNames,
23-
disableDistDeletion: pluginOptions.disableDistDeletion,
25+
distDeletionPolicy: pluginOptions.distDeletionPolicy,
2426
experimental: pluginOptions.experimental,
2527
distDir: distDirAbsolute,
28+
checkDistFreshness: () => {
29+
return !fs.existsSync(".next/build-manifest.json");
30+
},
2631
cacheDir,
2732
});
2833
}

pnpm-lock.yaml

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)