solidjs / solid-start

SolidStart, the Solid app framework
https://start.solidjs.com
MIT License
5.17k stars 375 forks source link

solidstart with auth -> failure: Missing "./data" export in "solid-start" package #151

Closed DBBrowne closed 2 years ago

DBBrowne commented 2 years ago
<project-folder> $ npm init solid@next         

create-solid version 0.1.0-alpha.75

Welcome to the SolidStart setup wizard!

There are definitely bugs and some feature might not work yet.
If you encounter an issue, have a look at https://github.com/solidjs/solid-start/issues and open a new one, if it is not already tracked.

✔ Which template do you want to use? › with-auth
✔ Server Side Rendering? … no
✔ Use TypeScript? … no

found matching commit hash: cee57b7708d6c90b2e8336d4116c891b21f95046

...

<project-folder> $ npm install
...
<project-folder> $ npm run dev
22:52:00 [vite] Internal server error: Missing "./data" export in "solid-start" package
  Plugin: vite:import-analysis
  File: <project-path>/src/routes/login.jsx

image

nksaraf commented 2 years ago

Heyy this was an issue in the examples are they are served from main branch here, but we changed some APIs without doing a release yet that caused this mismatch. We are going to do a release soon and that should fix this!

dertieran commented 2 years ago

I'm also having issues running the ssr version of the with-auth template. Not sure if this is related but at least the final error is different. (The issue exists for the non typescript version.)

✔ Which template do you want to use? › with-auth
✔ Server Side Rendering? … yes
✔ Use TypeScript? … yes
found matching commit hash: 25406e4ff746066b11123fb511b0d41ba2b0e12b
Error Log ``` GET / Missing "./data" export in "solid-start" package Missing "./data" export in "solid-start" package (x2) 11:16:36 AM [vite] Error when evaluating SSR module /node_modules/cookie/index.js?v=2a8788d2: ReferenceError: exports is not defined at /node_modules/cookie/index.js?v=2a8788d2:15:1 at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50311:15) 11:16:36 AM [vite] Error when evaluating SSR module /node_modules/solid-start/session/cookies.ts: ReferenceError: exports is not defined at /node_modules/cookie/index.js?v=2a8788d2:13:1 at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50311:15) 11:16:36 AM [vite] Error when evaluating SSR module /node_modules/solid-start/session/cookieStorage.ts: ReferenceError: exports is not defined at /node_modules/cookie/index.js?v=2a8788d2:11:1 at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50311:15) 11:16:36 AM [vite] Error when evaluating SSR module /node_modules/solid-start/session/index.ts?v=2a8788d2: ReferenceError: exports is not defined at /node_modules/cookie/index.js?v=2a8788d2:9:0 at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50311:15) 11:16:36 AM [vite] Error when evaluating SSR module /src/db/session.tsx: ReferenceError: exports is not defined at /node_modules/cookie/index.js?v=2a8788d2:7:0 at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50311:15) 11:16:36 AM [vite] Error when evaluating SSR module /src/routes/index.tsx?data: ReferenceError: exports is not defined at /node_modules/cookie/index.js?v=2a8788d2:5:0 at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50311:15) 11:16:36 AM [vite] Error when evaluating SSR module /node_modules/solid-start/root/Routes.tsx: ReferenceError: exports is not defined at /node_modules/cookie/index.js?v=2a8788d2:3:0 at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50311:15) 11:16:36 AM [vite] Error when evaluating SSR module /node_modules/solid-start/root/index.tsx: ReferenceError: exports is not defined at /node_modules/cookie/index.js?v=2a8788d2:1:0 at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50311:15) 11:16:36 AM [vite] Error when evaluating SSR module /node_modules/solid-start/entry-server/StartServer.tsx: Error: `line` must be greater than 0 (lines start at line 1) at originalPositionFor$1 (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:16780:19) at node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50162:25 at String.replace () at node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50152:21 at Array.map () at ssrRewriteStacktrace (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50151:10) at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50316:32) 11:16:36 AM [vite] Error when evaluating SSR module /node_modules/solid-start/entry-server/index.ts?v=2a8788d2: Error: `line` must be greater than 0 (lines start at line 1) at originalPositionFor$1 (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:16780:19) at node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50162:25 at String.replace () at node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50152:21 at Array.map () at ssrRewriteStacktrace (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50151:10) at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50316:32) 11:16:36 AM [vite] Error when evaluating SSR module src/entry-server: Error: `line` must be greater than 0 (lines start at line 1) at originalPositionFor$1 (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:16780:19) at node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50162:25 at String.replace () at node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50152:21 at Array.map () at ssrRewriteStacktrace (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50151:10) at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50316:32) ERROR Error: `line` must be greater than 0 (lines start at line 1) at originalPositionFor$1 (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:16780:19) at node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50162:25 at String.replace () at node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50152:21 at Array.map () at ssrRewriteStacktrace (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50151:10) at instantiateModule (node_modules/vite/dist/node/chunks/dep-c9998dc6.js:50316:32) ```

Edit: If I stub createCookieSessionStorage I get the same Missing "./data" export in "solid-start" package error. So there might be also an issue with the cookie module/implementation.

Edit2: Okay it seems like the cookie module was already replaced with a custom implementation in the main branch. FIY I just created my own createCookie implementation using @tinyhttp/cookie and it also works fine. (If you don't want to maintain your own cookie implementation)

nksaraf commented 2 years ago

FIY I just created my own createCookie implementation using @tinyhttp/cookie and it also works fine. (If you don't want to maintain your own cookie implementation)

We might use this, don't want to maintain our own implementation, but esm was becoming a problem.

Also with installing latest solid-start version, this ./data export issue should go away..