Would importing the css files as a require('./index.css') mean you'd need a custom webpack config on the other end to pull it through? Not sure if that require would resolve when you used the package. Unsure though, not tried it out myself.
You were right about that, it didn't work correctly when you pulled it from npm. I added the postcss plugin to the tutorial and now it should work as expected. Thanks for the heads up!
I think not using require actually would require a custom rollup plugin from the look of it. When using ESM type imports for CSS I get an error, but maybe I'm missing something?
Something like: github.com/thgh/rollup-plugin-css-.... I'm kind of a noob with Rollup though, more familiar with Webpack and CRA. If there's a better way to do this without having to install a plugin I'm all ears.
Styled-components would support this natively, I think. That should be fairly easy to drop in to your code examples above. Or a similar css-in-js solution.
Either that, or you'd need to allow users to import the CSS file directly, similar to how react-toastify handles it.
What's the error you're getting? A TS error or a Rollup error? (I am also pretty clueless with rollup, also a CRA boi)
Would importing the css files as a
require('./index.css')
mean you'd need a custom webpack config on the other end to pull it through? Not sure if thatrequire
would resolve when you used the package. Unsure though, not tried it out myself.You were right about that, it didn't work correctly when you pulled it from npm. I added the postcss plugin to the tutorial and now it should work as expected. Thanks for the heads up!
Nice, good stuff.
I think not using
require
actually would require a custom rollup plugin from the look of it. When using ESM type imports for CSS I get an error, but maybe I'm missing something?Something like: github.com/thgh/rollup-plugin-css-.... I'm kind of a noob with Rollup though, more familiar with Webpack and CRA. If there's a better way to do this without having to install a plugin I'm all ears.
Styled-components would support this natively, I think. That should be fairly easy to drop in to your code examples above. Or a similar css-in-js solution.
Either that, or you'd need to allow users to import the CSS file directly, similar to how
react-toastify
handles it.What's the error you're getting? A TS error or a Rollup error? (I am also pretty clueless with rollup, also a CRA boi)
When running
npm start
: