#Error when building the storefront

2 messages · Page 1 of 1 (latest)

ocean ermine
#

I'm having type errors when I try yarn build for the storefront and they are all related to medusa components now.

Initially I had type errors when I installed shadcn UI library for the shadcn components but this was fixed by downgrading the @types/react version and removing the resolutions version which was 17.0.40
So I'm not sure if this caused the problem with medusa components.

my package.json

...
"resolutions": {
    "webpack": "^5"
  },
  "dependencies": {
    ...
    "react": "^18.2.0",
    ...
  },
  "devDependencies": {
    ...
    "@types/react": "^18.2.23",
    "@types/react-dom": "^18.2.18",
    ...
    "typescript": "^5.3.2"
  }
...

And this is an example error

./src/modules/checkout/components/shipping-address/index.tsx:37:39
Type error: Parameter 'c' implicitly has an 'any' type.

  35 |
  36 |   const countriesInRegion = useMemo(
> 37 |     () => cart?.region.countries.map((c) => c.iso_2),
     |                                       ^
  38 |     [cart?.region]
  39 |   )
  40 |

Of course when I fix this error manually another one spawns and so on ..

full swallow
#

running yarn build locally on storefront gave me all of this too. Try deploying the medusa-create-app@latest backend to railway with nextJS storefront and the medusa admine to vercel. Here is the railway template I made for exactly this: https://railway.app/template/ITrZwu?referralCode=QUKEew

I had to move my dns records to cloudflare and turn off all proxies in order to get this configuration to work.

when I deployed this configuration there were no type checking errors. Running yarn build locally on the nextJS storefront wanted my to handle implicit any types everywhere.

Railway

Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.