Closed h2ck4u closed 3 months ago
i solved with tsup.config.js
i change loader 'css': 'default' > 'css: 'copy',
loader: {
'.css': 'default'
},
You can also check out this repo - https://github.com/react18-tools/turborepo-template/
while @h2ck4u's solution works, but it
on the other hand local-css
option does solve the above two problem, but not automatically imported inside the js file, so I've to manually import it in consumer app.
I have built a plugin for this - https://github.com/react18-tools/esbuild-plugin-react18-css/
Example - https://github.com/react18-tools/turborepo-template/
@mayank1513, appreciate your effort. But your library still has the last problem I mentioned (i.e. manual import for css is needed). I am looking for css injection in JS.
@mayank1513, appreciate your effort. But your library still has the last problem I mentioned (i.e. manual import for css is needed). I am looking for css injection in JS.
Noted! Please create a feature request. I think this is very much doable and in the next version we could try to have this feature as well.
hello. I'm creating a react library using tsup in a turborepo environment.
I checked that the bundle result contains the classname of the cssModule as an object.
I deployed the bundled library as an npm package and imported it in MyApp to use it.
When I checked the rendered component, the style was not applied.
This is because the stylesheet included in input.module.css was not included in the bundle.
Is there a way to include styles when deploying a React component library using TSUP? Please help me.
Upvote & Fund