S
SolidJS2mo ago
raf

Cannot build SSG

So i'm trying to build SSG instead of SPA so it works better with SEO, however during prerendering, it always return this error
SyntaxError: The requested module 'file://C:/Users/RAFLYMAULANA/Documents/Github/@takodotid/v2-frontend/node_modules/.pnpm/[email protected]/node_modules/solid-js/web/dist/server.js' does not provide an export
SyntaxError: The requested module 'file://C:/Users/RAFLYMAULANA/Documents/Github/@takodotid/v2-frontend/node_modules/.pnpm/[email protected]/node_modules/solid-js/web/dist/server.js' does not provide an export
during building everything fine, if i compile to SPA everything is working fine too, however when trying to build SSG, it just fail, if the result output index.html, it just empty <div id="#app"></div> with no content my app.config.ts
export default defineConfig({
vite: {
resolve: {
alias: {
"@": resolve(dirname(fileURLToPath(import.meta.url)), "src"),
"@assets": resolve(dirname(fileURLToPath(import.meta.url)), "assets"),
},
},
},
server: {
static: true,
prerender: {
routes: ["/", "/about"],
},
},
});
export default defineConfig({
vite: {
resolve: {
alias: {
"@": resolve(dirname(fileURLToPath(import.meta.url)), "src"),
"@assets": resolve(dirname(fileURLToPath(import.meta.url)), "assets"),
},
},
},
server: {
static: true,
prerender: {
routes: ["/", "/about"],
},
},
});
3 Replies
raf
raf2mo ago
fyi, this is a simple solid start app, and i found out that solid ssr is wonky af it turns out the error happens since i remove ssr:false to allow prerendering
Madaxen86
Madaxen862mo ago
Did you try to remove the path alias in the config? Maybe this messes up the build.
Joe Pea
Joe Pea2mo ago
"does not provide an export" What's the rest of the error? I'm guessing that if you made a vite.resolve.alias config, then you will also need to configure that for other cases. Vite is only for dev mode I believe. Maybe you can put an importmap in your app to set the aliases for other modes. Or better yet, don't use the alias for now, get it working with just relative paths first, then go from there. The thing is, Solid Start is built on 3rd-party build tools, so it cannot guess everything you want to do for all tools based on the config for any one tool. F.e., if you configure vite.resolve.alias, then you'll also need to configure paths in tsconfig for TypeScript, etc, etc, etc.
Want results from more Discord servers?
Add your server