0

I get a compilation error when I import "@shopify/polaris/styles.css";

This is a picture of the error: enter image description here

But whenever I go in to the styles.css, and do a search for the line that errors out, it doesn't find it so it seems like as though that line doesn't exist. Any help would be great. Thanks!

jim
  • 1,026
  • 2
  • 15
  • 37
  • 1
    Had the same issue a couple of weeks back after upgrading to CRA2. Best to upgrade to the latest version of Polaris and it should sort it (currently 3.0.0-RC3) – cdavid15 Oct 22 '18 at 20:03
  • @cdavid15 thanks i will try that. if you want to write that in the answer I'll mark it as the correct answer if all is good – tee Oct 24 '18 at 15:03

4 Answers4

2

If you're in 2022, and getting the same error that's because they moved it again. Use this in your AppProvider component.

import "@shopify/polaris/build/esm/styles.css";

ski_power
  • 21
  • 3
1

This was a known issue as detailed on the following issue:

https://github.com/Shopify/polaris/issues/441

Upgrade to the next version (3.0.0-RC3) and it should be fine

cdavid15
  • 413
  • 7
  • 14
0

If you don't want to upgrade as the previous answer suggested, you can also just add the direct CSS link in your html file and remove the "import "@shopify/polaris/styles.css";"

<link rel="stylesheet" href="https://sdks.shopifycdn.com/polaris/2.12.1/polaris.min.css" />
0

In order to upgrade to Polaris 3.0.0-RC4 from commandline, you can just use npm:

npm install https://github.com/Shopify/polaris-react.git#78946cfa2b75592a5ccc536bf2176be8dadb1bfa --save-dev