solid-start
solid-start copied to clipboard
[Bug?]: Basic solid-start project from template is not working in npm workspaces
Duplicates
- [x] I have searched the existing issues
Latest version
- [x] I have tested the latest version
Current behavior 😯
Starting a new standalone solid-start project with npm init solid@latest and selecting basic works fine
But when i move to a monorepo structure with npm workspaces, things start breaking
This is my project structure
package.json
apps
|- courseware
|- package.json
root package.json
{
"name": "myapp",
"scripts": {},
"keywords": [],
"author": "",
"license": "ISC",
"workspaces": [
"apps/courseware"
],
"dependencies": {
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.1.0",
"solid-js": "^1.9.5",
"vinxi": "^0.5.7"
},
"devDependencies": {},
"engines": {
"node": ">=22"
}
}
apps/courseware/package.json
{
"name": "@myapp/courseware",
"type": "module",
"scripts": {
"dev": "vinxi dev",
"build": "vinxi build",
"start": "vinxi start",
"version": "vinxi version"
}
}
running npm run dev -w="@myapp/courseware" gives the following error
Error: Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with .
at notSup (file:///app/node_modules/solid-js/web/dist/server.js:671:9)
at file:///app/node_modules/@solidjs/router/dist/index.js:1637:27
at ModuleJob.run (node:internal/modules/esm/module_job:329:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1233:24)
at async SSRCompatModuleRunner.cachedRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1180:76)
at async eval (/app/apps/courseware/src/app.tsx:6:259)
at async ESModulesEvaluator.runInlinedModule (file:///app/node_modules/vite/dist/node/module-runner.js:1062:5)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1284:61)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:25274:23)
at async SSRCompatModuleRunner.cachedRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1180:76)
at async eval (/app/node_modules/@solidjs/start/dist/server/StartServer.jsx:4:562)
at async ESModulesEvaluator.runInlinedModule (file:///app/node_modules/vite/dist/node/module-runner.js:1062:5)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1284:61)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:25274:23)
at async SSRCompatModuleRunner.cachedRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1180:76)
at async eval (/app/node_modules/@solidjs/start/dist/server/index.jsx:7:31)
at async ESModulesEvaluator.runInlinedModule (file:///app/node_modules/vite/dist/node/module-runner.js:1062:5)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1284:61)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:25274:23)
at async SSRCompatModuleRunner.cachedRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1180:76)
at async eval (/app/apps/courseware/src/entry-server.tsx:8:142)
at async ESModulesEvaluator.runInlinedModule (file:///app/node_modules/vite/dist/node/module-runner.js:1062:5)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1284:61)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:25274:23)
at async SSRCompatModuleRunner.cachedRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1180:76)
at async eval (virtual:$vinxi/handler/ssr:4:31)
at async ESModulesEvaluator.runInlinedModule (file:///app/node_modules/vite/dist/node/module-runner.js:1062:5)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1284:61)
at async SSRCompatModuleRunner.directRequest (file:///app/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:25274:23)
at async SSRCompatModuleRunner.cachedRequest (file:///app/node_modules/vite/dist/node/module-runner.js:1180:76)
at async SSRCompatModuleRunner.import (file:///app/node_modules/vite/dist/node/module-runner.js:1117:12)
at async instantiateModule (file:///app/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:25231:12)
at async handler (file:///app/node_modules/vinxi/lib/router-modes.js:313:36)
at async _callHandler (file:///app/node_modules/h3/dist/index.mjs:1862:16)
at async file:///app/node_modules/h3/dist/index.mjs:2003:19
at async Object.callAsync (file:///app/node_modules/unctx/dist/index.mjs:72:16)
at async Server.toNodeHandle (file:///app/node_modules/h3/dist/index.mjs:2295:7)
Surprisingly though the build and start commands work fine in the monorepo setting
Doing npm run build -w="@myapp/courseware" and then npm run start -w=@myapp/courseware"
Shows the preview just fine
Expected behavior 🤔
Solid start dev command in workspace setting should work
Your environment 🌎
Debian GNU/Linux 12 (bookworm)
Running inside a docker container in MAC OS (arm chip)