You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
css.inject adds import './style.css'; to CJS builds #1135
Create a repo with a src/index.ts and a src/styles.css. src./index.ts needs to have import './styles.css'; Populate styles.css with whatever css you want
Have @tsdown/css as a dependency
tsdown.config.ts should be configured with at least:
After running tsdown, the very first line of both dist/index.mjs and dist/index.cjs has import './style.css';, dist/indest.cjs should have require('./style.css');
What is expected?
dist/indest.cjs should have require('./style.css');
What is actually happening?
dist/indest.cjs has an ESM import import './style.css';
Any additional comments?
Current workaround, replace css: { inject: true } } with the following in tsdown.config.ts:
banner: ({ format }) => ({ js: format === 'cjs' ? "require('./style.css');" : "import './style.css';" }),
Activity