Describe the problem
Monorepos are becoming more common as more effort is invested into improved tooling. E.g. nx and bazel.
For the purposes of this feature request I'm excluding monorepo set ups such as yarn workspaces, lerna and pnpm that assume each 'package' has its own package.json and node_modules dir (even if its linked). I'm referring to monorepos that don't necessarily preserve the canonical structure of an app with a package.json at its source root.
The requirements for getting tools to work with monorepos means potentially supporting multiple apps that might live under the same source root and share the same node_modules.
The multiple app paradigm basically means that svelte_kit should support:
- passing an arbitrary source root to build (at a path underneath
package.json)
- passing an arbitrary path for outputs (at a destination even outside source root)
- ensuring that build/serve of different apps being served simultaneously are isolated under
node_modules/.vite
bazel specifically, would require args like source_root_path and output_path to be able to be passed to svelte_kit binary as command arguments.
Vite already supports this kind of set up, they demonstrate ways to run multiple apps under a single vite configuration here: https://vitejs.dev/guide/build.html#multi-page-app and tout being monorepo friendly.
Also vite is already friendly towards dependencies located in the same repo: https://vitejs.dev/guide/dep-pre-bundling.html#monorepos-and-linked-dependencies
It should be possible to host multiple apps under a single vite configuration. Why not the same for svelte-kit?
Describe the proposed solution
In theory, Vite already has all the tools needed to be monorepo friendly. It's just a matter of allowing svelte_kit to be run the same way.
Already, running: node ../../node_modules/@sveltejs/kit/svelte-kit.js dev from a nested kind of works... (It'll error up until you refresh the browser, and then won't serve some routes properly).
Sveltekit could surface vite features like:
- passing
root from command args, or perhaps a path to a svelte.config.js, or...
- specifying multiple *.html roots/apps in a single
svelte.config.js file.
- specifying arbitrary output paths for adapters
- specifying vite cache path (or otherwise isolating caches of different apps)
Seems... possible.... but here be dragons...?
Alternatives considered
Git submodules
...j/k
Importance
would make my life easier
Additional Information
I think spending a little amount of time on this now will allow for early adoption for tools like nx and bazel.
Describe the problem
Monorepos are becoming more common as more effort is invested into improved tooling. E.g.
nxandbazel.For the purposes of this feature request I'm excluding monorepo set ups such as
yarn workspaces,lernaandpnpmthat assume each 'package' has its ownpackage.jsonandnode_modulesdir (even if its linked). I'm referring to monorepos that don't necessarily preserve the canonical structure of an app with a package.json at its source root.The requirements for getting tools to work with monorepos means potentially supporting multiple apps that might live under the same source root and share the same
node_modules.The multiple app paradigm basically means that
svelte_kitshould support:package.json)node_modules/.vitebazelspecifically, would require args likesource_root_pathandoutput_pathto be able to be passed tosvelte_kitbinary as command arguments.Vite already supports this kind of set up, they demonstrate ways to run multiple apps under a single vite configuration here: https://vitejs.dev/guide/build.html#multi-page-app and tout being monorepo friendly.
Also vite is already friendly towards dependencies located in the same repo: https://vitejs.dev/guide/dep-pre-bundling.html#monorepos-and-linked-dependencies
It should be possible to host multiple apps under a single vite configuration. Why not the same for svelte-kit?
Describe the proposed solution
In theory, Vite already has all the tools needed to be monorepo friendly. It's just a matter of allowing svelte_kit to be run the same way.
Already, running:
node ../../node_modules/@sveltejs/kit/svelte-kit.js devfrom a nested kind of works... (It'll error up until you refresh the browser, and then won't serve some routes properly).Sveltekit could surface vite features like:
rootfrom command args, or perhaps a path to asvelte.config.js, or...svelte.config.jsfile.Seems... possible.... but here be dragons...?
Alternatives considered
Git submodules
...j/k
Importance
would make my life easier
Additional Information
I think spending a little amount of time on this now will allow for early adoption for tools like
nxandbazel.