Shopify / polaris-viz

A collection of React and React native components that compose Shopify's data visualization system
https://polaris-viz.shopify.com
Other
322 stars 23 forks source link

Unable to resolve polaris-viz import #1707

Closed JuanCaicedo closed 4 weeks ago

JuanCaicedo commented 1 month ago

Bug summary

Hi everyone! I'm having trouble loading polaris-viz into a Shopify app.

I suspect that this might be something wrong with my bundling strategy (vite + swc), but since I'm able to import other modules without a problem (like @shopify/polaris) I thought it was worth asking here.

Expected behavior

Able to import from polaris-viz

Actual behavior

When I add the following line

import { PolarisVizProvider } from '@shopify/polaris-viz'

I get the following error

Failed to resolve import "@shopify/polaris-viz" from "web/routes/campaign.jsx". Does the file exist?

I also get the same error if I try

import { PolarisVizProvider } from '@shopify/polaris-viz/build/esm/index'

Specifications

  System:
    OS: macOS 14.4.1
    CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
    Memory: 40.80 MB / 16.00 GB
    Shell: 5.7.1 - /usr/local/bin/zsh
  Binaries:
    Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.13.1/bin/yarn
    npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Brave Browser: 126.1.67.123
    Chrome: 126.0.6478.183
    Safari: 17.4.1
  npmPackages:
    @shopify/polaris-viz: ^14.4.0 => 14.4.0 
    react: ^18.2.0 => 18.3.1 
    react-dom: ^18.2.0 => 18.3.1 
JuanCaicedo commented 4 weeks ago

I now think that this is an error with my build setup