esbuild-css-modules-plugin
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -0,1 +1,4 @@ | ||
## V3.1.2 | ||
- fix [issue#74](https://github.com/indooorsman/esbuild-css-modules-plugin/issues/74) | ||
## V3.1.1 | ||
@@ -2,0 +5,0 @@ - fix build with `bundle: true` & `splitting: true` & multiple entrypoints |
13
index.js
@@ -357,9 +357,10 @@ import { basename, dirname, extname, normalize, relative, resolve, sep } from 'node:path'; | ||
.then(([css, js]) => { | ||
const cssContent = simpleMinifyCss(css, patchedBuild.esbuild); | ||
const digest = genDigest(c, buildId); | ||
const newJs = js | ||
.replace( | ||
contentPlaceholder, | ||
JSON.stringify(simpleMinifyCss(css, patchedBuild.esbuild)) | ||
) | ||
.replace(digestPlaceholder, JSON.stringify(genDigest(c, buildId))); | ||
return newJs; | ||
.replaceAll(contentPlaceholder, `globalThis['__css-content-${digest}__']`) | ||
.replaceAll(digestPlaceholder, `globalThis['__css-digest-${digest}__']`); | ||
return `globalThis['__css-content-${digest}__']=${JSON.stringify( | ||
cssContent | ||
)};globalThis['__css-digest-${digest}__']=${JSON.stringify(digest)};\n${newJs}`; | ||
}) | ||
@@ -366,0 +367,0 @@ .then((newJs) => writeFile(fullJsPath, newJs, { encoding: 'utf8' })); |
{ | ||
"name": "esbuild-css-modules-plugin", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "A esbuild plugin to bundle css modules into js(x)/ts(x), based on extremely fast [Lightning CSS](https://lightningcss.dev/)", | ||
@@ -5,0 +5,0 @@ "main": "./index.cjs", |
44275
1138