0.0.1 • Published 3 years ago
vite-solid-ssg-pages v0.0.1
This plugin allows to render certain pages statically and serve them on specific paths.
pnpm i -D vite-solid-ssg-pages
Imagine you want to deploy blog alogside with app
- Add input to rollup options:
input: {
app: './index.html',
blog: './blog/blog.html',
},
- Add plugin:
solidSsgPages({
entries: [
{
htmlPath: './blog/blog.html',
ssrEntry: './blog/blog.tsx',
urlAlias: '/blog',
outputPath: './blog.html',
},
],
solidPluginOptionsRef: solidOptions,
})
In dev mode, localhost:3000/blog
will serve ./blog/blog.html
page.
In production, ./blog/blog.html
will be placed at dist/blog.html
.
Note: you need to pass reference to solid options! This hack is nescessary.
const solidOptions: Partial<SolidOptions> = {
hot: dev,
dev: dev,
extensions: ['.md', '.mdx'],
ssr: true,
}
plugins: [
solid(solidOptions),
solidSsgPages({
entries: [
{
htmlPath: './blog/blog.html',
ssrEntry: './blog/blog.tsx',
urlAlias: '/blog',
outputPath: './blog.html',
},
],
solidPluginOptionsRef: solidOptions,
}),
]
build: {
rollupOptions: {
input: {
app: './index.html',
blog: './blog/blog.html',
},
}
}
Checkout examples
0.0.1
3 years ago