S
SolidJS12mo ago
rabbit

Can't route with Solid Router in subfolder of multi-page Vite app

i have a folder structure where my solid app exists inside of /prefabs with children like /prefabs/index.html and /prefabs/src/index.tsx. at the root of the folder structure is /vite.config.ts which looks like this. (/techdc/ is not a solid application, its just TypeScript.)
import { defineConfig } from 'vite'
import { resolve } from 'path'
import solidPlugin from 'vite-plugin-solid'

export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
prefabs: resolve(__dirname, 'prefabs/index.html'),
techdc: resolve(__dirname, 'techdc/index.html'),
},
},
target: 'esnext',
},
})
import { defineConfig } from 'vite'
import { resolve } from 'path'
import solidPlugin from 'vite-plugin-solid'

export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
prefabs: resolve(__dirname, 'prefabs/index.html'),
techdc: resolve(__dirname, 'techdc/index.html'),
},
},
target: 'esnext',
},
})
this works really well! i can access /techdc and it works; and i can access the working Solid app if i have a <Route> path set to /prefabs like below
<Router>
<Route path={'/prefabs'} component={App} />
<Route path={'/prefabs/ex'} component={App} />
</Router>
<Router>
<Route path={'/prefabs'} component={App} />
<Route path={'/prefabs/ex'} component={App} />
</Router>
but going to /prefabs/ex just loads /index.html rather than the {App} component. i'm not sure if this is a limitation of not having the solid app be the root of my website. any input and help is appreciated
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server