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

'css' is not exported from 'styled-components/macro' #264

Closed
hendrul opened this issue Dec 16, 2020 · 10 comments
Closed

'css' is not exported from 'styled-components/macro' #264

hendrul opened this issue Dec 16, 2020 · 10 comments

Comments

@hendrul
Copy link

hendrul commented Dec 16, 2020

import css using twin.macro with styled-components fails. Below is the error when running local in my machine the cra-styled-component example. It works on codesandbox, but not local.

./src/components/Button.js
Attempted import error: 'css' is not exported from 'styled-components/macro' (imported as '_css').
@ben-rogerson ben-rogerson transferred this issue from ben-rogerson/twin.macro Dec 16, 2020
@ben-rogerson
Copy link
Owner

ben-rogerson commented Dec 16, 2020

I'm seeing this too when I use yarn to install.
npm works fine - I'll have to look into this issue further.

You can fix it for now by using this twin config:

  "babelMacros": {
    "twin": {
      "preset": "styled-components",
      "css": {
        "from": "styled-components",
        "import": "css"
      }
    }
  },

Has babel updated something lately?

@hendrul
Copy link
Author

hendrul commented Dec 16, 2020

@ben-rogerson thanks a million for the fast response.
npm works fine
To me It's failing on both yarn or npm

@ben-rogerson ben-rogerson transferred this issue from ben-rogerson/twin.examples Dec 16, 2020
@audishos
Copy link

@ben-rogerson thanks a million for the fast response.
npm works fine
To me It's failing on both yarn or npm

I'm seeing the same. The strangest thing about it is that it works fine in one component, but fails when I try and import into another. Both components are in the same directory.

ben-rogerson added a commit to ben-rogerson/twin.examples that referenced this issue Dec 23, 2020
Current issues with the macro imports from styled-components in CRA:
ben-rogerson/twin.macro#264
@ben-rogerson
Copy link
Owner

ben-rogerson commented Jan 6, 2021

I've now adjusted the preset in 2.0.8 to remove the macro import, this will avoid this error in CRA now.

Edit: You'll need to make sure you're not manually specifying your imports, just use preset: 'styled-components' in your twin config.

@jeremyzilar
Copy link

FYI, I just tried this with npm install and I got the same error

'css' is not exported from 'styled-components/macro'

So I cleared away the repo, and tried again using yarn and everything seems to work.

@ben-rogerson
Copy link
Owner

FYI, I just tried this with npm install and I got the same error

'css' is not exported from 'styled-components/macro'

So I cleared away the repo, and tried again using yarn and everything seems to work.

Sounds like some caching happening there 🤷‍♂️

@jonleopard
Copy link
Contributor

Was anyone able to resolve this? I just ran npx degit on the styled-components repo and I'm getting this error on a fresh install.

@jeremyzilar
Copy link

I think @ben-rogerson is correct. The cache needed to be cleared. I have been blowing away my Next.js folder (rm -rf .next) after each edit to my tailwind.config.js

@isaif
Copy link

isaif commented Feb 3, 2021

For me clearing the .next directory doesn't work but using yarn does.

@ben-rogerson
Copy link
Owner

Nuking your node_modules and npm installing may have fixed it too

ben-rogerson added a commit that referenced this issue Jan 19, 2024
<p>This PR was automatically created by Snyk using the credentials of a
real user.</p><br /><h3>Snyk has created this PR to upgrade
postcss-selector-parser from 6.0.10 to 6.0.13.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.
<hr/>

- The recommended version is **3 versions** ahead of your current
version.
- The recommended version was released **7 months ago**, on 2023-05-15.


<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>postcss-selector-parser</b></summary>
    <ul>
      <li>
<b>6.0.13</b> - <a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/releases/tag/v6.0.13">2023-05-15</a></br><h1>6.0.13</h1>
<ul>
<li>Fixed: throw on unexpected pipe symbols</li>
</ul>
      </li>
      <li>
<b>6.0.12</b> - <a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/releases/tag/v6.0.12">2023-04-29</a></br><h1>6.0.12</h1>
<ul>
<li>Fixed: <code>clone</code> arguments should be optional</li>
</ul>
      </li>
      <li>
<b>6.0.11</b> - <a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/releases/tag/v6.0.11">2022-11-20</a></br><h1>6.0.11</h1>
<ul>
<li>Fixed: parse attribute case insensitivity flag</li>
</ul>
      </li>
      <li>
<b>6.0.10</b> - <a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/releases/tag/v6.0.10">2022-03-30</a></br><h1>6.0.10</h1>
<ul>
<li>Fixed: <code>isPseudoElement()</code> supports
<code>:first-letter</code> and <code>:first-line</code></li>
</ul>
      </li>
    </ul>
from <a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/releases">postcss-selector-parser
GitHub release notes</a>
  </details>
</details>


<details>
  <summary><b>Commit messages</b></summary>
  </br>
  <details>
    <summary>Package name: <b>postcss-selector-parser</b></summary>
    <ul>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/9b5ade24d4c15029a65dddf6d6bdedbf67789045">9b5ade2</a>
chore(release): 6.0.13</li>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/317e2753d91f8a978987a1b7a2ccac2c9bc04bbb">317e275</a>
fix: throw on unexpected pipe symbols (#278)</li>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/2c24f44512d9416329f6e397ad0d3c1be56bcee6">2c24f44</a>
docs: update clone (#277)</li>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/66b51528c1a74f98c387e767c5564ace2a8d271f">66b5152</a>
chore(release): 6.0.12</li>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/63b463e075ddeb4e1670de5635f1f2fb23b303e2">63b463e</a>
fix(types): clone (#276)</li>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/6d3bd5728a787127021ab82e874c2e6bc582a5dd">6d3bd57</a>
chore(deps): bump json5 from 2.2.1 to 2.2.3 (#274)</li>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/fe807ad92fe0091d81c55866bdb9a1ed2726801b">fe807ad</a>
chore: update dependencies (#268)</li>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/e6b4029387572dce965345f6de00b5e3bf666bc9">e6b4029</a>
chore(release): 6.0.11</li>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/fd5f0bfbddf036eb3e788e1dcd90341af292e07f">fd5f0bf</a>
fix: attribute case insensitivity parsing</li>
<li><a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/commit/c3db2ff377c33d8ee1a95466edf3120a9d2511e6">c3db2ff</a>
docs: fix &#x60;container.atPosition()&#x60; API (#264)</li>
    </ul>

<a
href="https://snyk.io/redirect/github/postcss/postcss-selector-parser/compare/91a0147812f219b9a64cd2d6a595e0a4b85c161b...9b5ade24d4c15029a65dddf6d6bdedbf67789045">Compare</a>
  </details>
</details>
<hr/>

**Note:** *You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs.*

For more information: <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI2YWU5M2NlYi0zMmMzLTQ0OTAtOWRlYi0xZDhiYTFjOThmZTYiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjZhZTkzY2ViLTMyYzMtNDQ5MC05ZGViLTFkOGJhMWM5OGZlNiJ9fQ=="
width="0" height="0"/>

🧐 [View latest project
report](https://app.snyk.io/org/ben-rogerson/project/5166ef83-6f86-471f-9f97-28d8b4709d32?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)

🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/ben-rogerson/project/5166ef83-6f86-471f-9f97-28d8b4709d32/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)

🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/ben-rogerson/project/5166ef83-6f86-471f-9f97-28d8b4709d32/settings/integration?pkg&#x3D;postcss-selector-parser&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

<!---
(snyk:metadata:{"prId":"6ae93ceb-32c3-4490-9deb-1d8ba1c98fe6","prPublicId":"6ae93ceb-32c3-4490-9deb-1d8ba1c98fe6","dependencies":[{"name":"postcss-selector-parser","from":"6.0.10","to":"6.0.13"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/ben-rogerson/project/5166ef83-6f86-471f-9f97-28d8b4709d32?utm_source=github&utm_medium=referral&page=upgrade-pr","projectPublicId":"5166ef83-6f86-471f-9f97-28d8b4709d32","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":3,"publishedDate":"2023-05-15T16:35:49.762Z"},"templateVariants":[],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false,"priorityScoreList":[]})
--->

Co-authored-by: snyk-bot <[email protected]>
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

No branches or pull requests

6 participants