Open Vempejul opened 1 year ago
css file should be generated with bundle: true
& inject: false
, I will have a try with tsup later
I'm also using it with tsup. I'm currently using bundle: true
and inject: true
as an alternative, but the project requires to import the CSS file separately. The main goal would be having the *.module.css
files parsed to *.css
with the content that is currently being injected.
Also, the injected setup doesn't minifies the content.
tsup v7.2.0 || v8.1.0 esbuild-css-modules-plugin v2.7.1
Obs: there is a mismatching dependency version of esbuild between tsup (>7.2.0) and esbuild-css-modules-plugin (>2.7.1).
With bundle: false
and inject: false
:
No CSS file generated in dist folder.
import styles from "./color.module.css";
With bundle: false
and inject: true
:
No CSS file generated in dist folder.
import styles from "./color.module.css";
With bundle: true
and inject: false
:
No CSS file generated in dist folder.
// esbuild-css-modules-plugin-namespace:/var/folders/mh/<someRandomHash>/T/tmp-<other-random-hash>/<package-name>/src/color.module.css.js
var color_module_css_default = { "someClass": "_someClass_irtoq_1" };
With bundle: true
and inject: true
:
No CSS file generated in dist folder.
// esbuild-css-modules-plugin-namespace:/var/folders/mh/<someRandomHash>/T/tmp-<other-random-hash>/<package-name>/src/color.module.css.js
var digest = "<someDigestHash>";
var css = `._someClass_irtoq_1 {
color: #fff;
}
`;
(function() {
if (typeof document === "undefined") {
return;
}
if (!document.getElementById(digest)) {
var el = document.createElement("style");
el.id = digest;
el.textContent = css;
document.head.appendChild(el);
}
})();
var color_module_css_default = { "someClass": "_someClass_irtoq_1" };
Hi!
I am using this plugin together with tsup builder and there is no css file generated when running this plugin. If I remove the plugin the css file is generated as expected.
This is my package.json:
Here are the esbuild options used:
And the tsup config extension:
The css module file is imported like this in src/index.tsx
This will end upp generating these files: "dist/index.d.ts", "dist/index.js" and "dist/index.mjs" and the css is injected correctly as an object in index.js and index.mjs like this
Is this supposed to generate a css file? If not, any input on how to manage this?