skip to Main Content

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!

4

Answers


  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

    Login or Signup to reply.
  2. 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" />
    
    Login or Signup to reply.
  3. 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
    
    Login or Signup to reply.
  4. 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";

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search