Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a way to use modules:true that not conflicts with external css files imports from node_modules? #298

Open
ricardosouza-logmein opened this issue Jul 22, 2020 · 3 comments

Comments

@ricardosouza-logmein
Copy link

I have this rollup configuration

postcss({
      extensions: [".css"],
      modules: true,
      extract: false,
    }),

and some of my components are importing a css from a lib

import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";

Using modules: true all the slick-carousel styles are "broken"

@jaybeeuu
Copy link

modules can be a postcss-modules settings object - have you tried using globalModulePaths?

e.g.

postcss({
  extensions: [".css"],
  modules: {
    globalModulePaths: [/slick-carousel/]
  },
  extract: false
}),
@ricardosouza-logmein
Copy link
Author

Thanks, it works

@grantralls
Copy link

I'm having the same issue. I'm following this tutorial to create a react component library with node 18. I have modules and extract set to true. When I run it I see the CSS output with the hashed names as I expect. When I change modules to be "modules: {}" all of the CSS classes lose their hashed naming. I'm using rollup 3.19 and rollup-plugin-postcss 4.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants