Skip to content

Commit 381ec90

Browse files
committed
Remove CSS module files by default
1 parent 5b5afe9 commit 381ec90

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"esbuild-plugin-react18-css": patch
3+
---
4+
5+
Remove peerDependencies

lib/esbuild-plugin-react18-css/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ interface CSSPluginOptions {
1515
skipAutoPrefixer?: boolean;
1616
/** global CSS class prefix. @defaultValue "" */
1717
globalPrefix?: string;
18+
/** If you want to keep .module.css files */
19+
keepModules?: boolean;
1820
}
1921

2022
function generateCombinedCSS(result: BuildResult) {
@@ -58,6 +60,10 @@ function applyAutoPrefixer(build: PluginBuild, options: CSSPluginOptions, write?
5860

5961
generateCombinedCSS(result);
6062

63+
if (!options.keepModules) {
64+
result.outputFiles = result.outputFiles?.filter(file => !file.path.match(/\.module\.css$/));
65+
}
66+
6167
/** assume true if undefined */
6268
if (write === undefined || write) {
6369
result.outputFiles?.forEach(file => {

0 commit comments

Comments
 (0)