nksaraf / vinxi

The Full Stack JavaScript SDK
https://vinxi.vercel.app
MIT License
1.33k stars 56 forks source link

Package.json subpath imports do not work #249

Open jakst opened 3 months ago

jakst commented 3 months ago

When updating solid-start from v0.6.0 to v0.7 I started getting this crash in the dev server for any page load. Not sure which underlying vinxi package is causing it though.

[h3] [unhandled] H3Error: Missing "#vinxi/handler/ssr" specifier in "app" package
    at e (file://./node_modules/.pnpm/vite@5.1.5/node_modules/vite/dist/node/chunks/dep-G-px366b.js:47398:25)

Turns out it's caused by specifying subpath imports in package.json. Even an empty object will trigger.

package.json

{
  // ...
  "imports": {}
  // ...
}

Here's a stackblitz reproduction https://stackblitz.com/edit/solidjs-solid-start-wtwqtu

nksaraf commented 3 months ago

what are "imports", i apologize i'm not familiar, so if you could explain what it does and why u need it, that would help in getting some direction

jakst commented 3 months ago

It's like tsconfig paths, but standardized. TS started supporting it for auto imports in v5.4, so it just recently became usable for real. This avoids a lot of tooling having to read the tsconfig file just to resolve paths.

You can read more here https://betterprogramming.pub/the-native-way-to-configure-path-aliases-in-frontend-projects-5db70f19a6e0

nksaraf commented 3 months ago

does vite support it?

jakst commented 3 months ago

Yes. https://github.com/vitejs/vite/issues/7385 https://github.com/vitejs/vite/pull/7770

Not completely sure which Vinxi version is causing the issues, but they started when upgrading from solid-start v0.6.0 to v0.7. Definitely worked with Vite before that.

nksaraf commented 3 months ago

Ahh okay lemme see what's wrong. If vite supports it we should be able to get it working too

Akkuma commented 2 months ago

This is still an issue as of 0.3.11