houdini icon indicating copy to clipboard operation
houdini copied to clipboard

Monorepo requires local @sveltejs/kit dependency

Open JannisKoeksel opened this issue 1 year ago • 0 comments

Describe the bug

In a mono repo, when using the Houdini vite build step. This bug occurs :

template:dev:  
template:dev:  > [email protected] dev
template:dev:  > vite dev
template:dev:  
template:dev:  🎩 Generating runtime...
template:dev:  💡 No operation found. If that's unexpected, please check your config.
template:dev:  Forced re-optimization of dependencies
template:dev:  
template:dev:    VITE v5.1.3  ready in 13480 ms
template:dev:  
template:dev:    ➜  Local:   http://localhost:5173/
template:dev:    ➜  Network: use --host to expose
template:dev:  Internal server error: Failed to load url /src/routes/+layout.js (resolved id: /src/routes/+layout.js). Does the file exist?
template:dev:        at loadAndTransform (/home/projects/stackblitz-starters-vzrahe/node_modules/vite/dist/node/chunks/dep-stQc5rCc.js:53621:21)
template:dev:        at async instantiateModule (/home/projects/stackblitz-starters-vzrahe/node_modules/vite/dist/node/chunks/dep-stQc5rCc.js:54643:10)
template:dev:  Internal server error: Failed to load url /src/routes/+page.js (resolved id: /src/routes/+page.js). Does the file exist?
template:dev:        at loadAndTransform (/home/projects/stackblitz-starters-vzrahe/node_modules/vite/dist/node/chunks/dep-stQc5rCc.js:53621:21)
template:dev:        at async instantiateModule (/home/projects/stackblitz-starters-vzrahe/node_modules/vite/dist/node/chunks/dep-stQc5rCc.js:54643:10)
template:dev:  Error: Failed to load url /src/routes/+layout.js (resolved id: /src/routes/+layout.js). Does the file exist?
template:dev:      at loadAndTransform (/home/projects/stackblitz-starters-vzrahe/node_modules/vite/dist/node/chunks/dep-stQc5rCc.js:53621:21)
template:dev:      at async instantiateModule (/home/projects/stackblitz-starters-vzrahe/node_modules/vite/dist/node/chunks/dep-stQc5rCc.js:54643:10) {
template:dev:    code: 'ERR_LOAD_URL'
template:dev:  }

It can be resolved by adding a

"devDependencies": {
	"@sveltejs/kit": "^2.5.0"
}

to

.
└── apps/
    └── exp/
        └── package.json

or by manually adding the page.js/ts and layout.js/ts files to every route. Without the houdini() build step, the issue does not occur even without the added dependency.

Reproduction

https://stackblitz.com/edit/houdini-bug-local-kit-dependency

JannisKoeksel avatar Feb 20 '24 19:02 JannisKoeksel