question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unable to import tremor.css

See original GitHub issue

Hello:

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:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mitrotasioscommented, Oct 5, 2022

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 the with-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!

1reaction
rrreposcommented, Oct 6, 2022

It just worked ! … even in my existing project. Must have made some stupid error. Thanks

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found