Closed neutrino2211 closed 6 months ago
@neutrino2211 You should externalise prisma in the vite config (Not sure what the exact package name is for prisma)
Something like this:
import pages from '@hono/vite-cloudflare-pages'
import honox from 'honox/vite'
import { defineConfig } from 'vite'
export default defineConfig(({ mode }) => {
if (mode === 'client') {
return {
build: {
rollupOptions: {
input: ['/app/style.css'],
output: {
assetFileNames: 'static/assets/[name].[ext]'
}
}
}
}
} else {
return {
ssr: {
external: ['prisma']
},
plugins: [honox(), pages()]
}
}
})
Great, thanks. It's all working now!!
@BasWilson Thanks for the support!
Yeah, we have to add it to ssr.external
if that throws the error.
What version of HonoX are you using?
0.1.4
What steps can reproduce the bug?
prisma/schema.prisma
app/routes/index.tsx
What is the expected behavior?
Expected behaviour is to have the index page contain a h1 with "Hello, Hono! 0". 0 denoting the number of user documents in the database.
What do you see instead?
An err
module is not defined
Additional information
I'm pretty sure it is an error with parsing commonjs modules but using @originjs/vite-plugin-commonjs does not really fix the issue and introduces the following error.