0

I have not been able to access the new Text component offered by the Shopify Polaris library. I am getting the following import error:

The requested module '/node_modules/.vite/deps/@shopify_polaris.js?v=e5492b37' does not provide an export named 'Text'

Any ideas on how to resolve this? The other text components are all deprecated and I'm using the latest version of Polaris.

Rage
  • 870
  • 9
  • 27
  • shopify polaris [definitely does export Text component](https://github.com/Shopify/polaris/blob/6cd75fd9a089791a79fe8aa7e43f6b54add47a45/polaris-react/src/index.ts#L366). Can you share more details? – TwistedOwl Dec 10 '22 at 22:16
  • @TwistedOwl I see the source code in my node modules and you are right but the error persists. I am using polaris version 10.15.0 and am running the shopify app using npm run dev – Rage Dec 10 '22 at 22:26
  • usually that problem occurs because the import statement is used wrong but it's hard to tell without knowing the source code. That's why I asked for more details :) – TwistedOwl Dec 10 '22 at 22:28
  • And the contents of your package.json can make a difference as well. – TwistedOwl Dec 10 '22 at 22:30
  • @TwistedOwl here is my package.json and import: https://justpaste.it/cw6s9 – Rage Dec 10 '22 at 22:36
  • Weird it looks good. I have tried the same config and template, and everything works just fine. Can you share vite.config.js? – TwistedOwl Dec 10 '22 at 23:32
  • @TwistedOwl here is my vite.config.js https://justpaste.it/cgayj – Rage Dec 11 '22 at 05:26
  • I think you can try looking into: https://stackoverflow.com/questions/73125972/the-requested-module-node-modules-vite-deps-vue-js-does-not-provide-an-expor Have you checked the `/node_modules/.vite/deps/@shopify_polaris.js?v=e5492b37` file? There must be a reason why it can't find it. Sorry for the chaotic troubleshooting but I am trying to understand it as well. I've tried to reproduce but everything works on my end (except I do not use TS and from the config I can assume that you do) – TwistedOwl Dec 13 '22 at 23:37
  • restarting the development server did it for me... :) – felixmp Dec 21 '22 at 16:23

1 Answers1

0

Manually updating version in web/frontend/package.json worked for me. It was 9.24.0 by default. Changed it to 10.32.0 and restarted the development server.

Aditya
  • 84
  • 3