unable to import tremor.css
See original GitHub issueHello:
In an existing next.js project, I am trying to import the tremor.css as per your documentation but received an error.
I first added the tremor npm using npm install @tremor/react
Then, I tried importing the css using import '@tremor/react/dist/esm/tremor.css';
Then, for a bit nothing seems to have and the cursor changes till finally I get the following message:
import-im6.q16: attempt to perform an operation not allowed by the security policy `@tremor/react/dist/esm/tremor.css' @ error/blob.c/OpenBlob/2624.```
I tried importing a Card in the component while it does not give me an error, it as expected did not apply the css
Thanks
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
CSS files cannot be treeshaken with side effects #4389 - GitHub
But I just import the component A , so the codes of B (including the CSS) should be treeshaken out. Vite treats all...
Read more >Directly imported CSS file from node modules oddly go missing
This is caused by a sideEffects: false setting I put into the package.json file of my dependency package to support Webpack tree shaking....
Read more >Tree shaking CSS Modules - Mark Murray
Tree shaking CSS Modules. Eliminate collisions with CSS Modules and cut down bundle sizes by purging unused styles.
Read more >CSS - Parcel
Note: Tree shaking only works when you reference classes using either a namespace or named import. Tree shaking does not work with default...
Read more >csshake - npm
When installed with npm , import csshake inside your css|stylus|sass files with ~ prefix to trigger webpack's module resolving: @import '~ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi! I tried to reproduce the issue by setting up a Docker image with Next and Tremor installed on a Linux Alpine distribution, as I could not find a suitable base image for Mint.
I created this repository and it seems to work fine, please feel free to clone the repo and try it out yourself. Note, that the
main
branch does not involve Tailwind, if you’d like to try out the container with Tailwind installed as well, please checkout thewith-tailwind
branch.Regarding your question on Tailwind: yes, even if Tailwind is already set up in your project, importing
tremor.css
is necessary. However, it is generally not required to have Tailwind set up in order to run Tremor.We are exporting a
tremor.css
file in our package since we found that to be the only viable solution so far to seamlessly run a server-side rendered application with Tremor. Exporting a CSS file is not optimal because it disables tree-shaking, so we are working on figuring out a more scalable solution in the future.Sorry that I can not help you out further with this issue at this point. I will try to look into it in the upcoming days!
It just worked ! … even in my existing project. Must have made some stupid error. Thanks