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

Error when importing values in pure mode #21

Closed
simonsmith opened this issue Mar 10, 2020 · 0 comments · Fixed by #23
Closed

Error when importing values in pure mode #21

simonsmith opened this issue Mar 10, 2020 · 0 comments · Fixed by #23

Comments

@simonsmith
Copy link

Hello,

I'm opening this issue off the back of - vercel/next.js#10142

It appears that when importing a value from another file when using pure mode an error is encountered. Example:

colors.css

@value blue: #001e62;

module.css

@value blue from "../colors.css";

CLI output:

Selector ":import("../colors.css")" is not pure (pure selectors must contain at least one local class or id)

Repository with a reproducible case - https://github.com/simonsmith/next-js-css-modules-unable-to-use--global-with-css-modules

npm install
npm run dev

Reproduce in tests
Find a test that references :import and add options: { mode: 'pure' } to see the same output in the console:

  {
    should: 'not localize imported alias',
    input: `
      :import(foo) { a_value: some-value; }

      .foo > .a_value { }
    `,
+   options: { mode: 'pure' },
    expected: `
      :import(foo) { a_value: some-value; }

      :local(.foo) > .a_value { }
    `,
  },

My rudimentary debugging has shown that the code checking for import in the class case is not entered, and instead we only see selector used

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

Successfully merging a pull request may close this issue.

1 participant