Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MIDO-ruby7 committed Mar 23, 2024
1 parent c473e98 commit ce4785b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240208.0",
"@hono/vite-cloudflare-pages": "^0.2.4",
"@hono/vite-cloudflare-pages": "^0.2.5",
"@hono/vite-dev-server": "^0.9.0",
"autoprefixer": "^10.4.18",
"postcss": "^8.4.35",
Expand Down
25 changes: 16 additions & 9 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
import devServer from '@hono/vite-dev-server'
import adapter from '@hono/vite-dev-server/cloudflare'
import build from '@hono/vite-cloudflare-pages'
import pagesBuild from '@hono/vite-cloudflare-pages'
import { defineConfig } from 'vite'
import { getPlatformProxy } from 'wrangler'

export default defineConfig( async () => {
const { env } = await getPlatformProxy()
export default defineConfig(async ({ mode, command }) => {
if (command === 'build') {
return {
plugins: [pagesBuild()]
}
}
const { env, dispose } = await getPlatformProxy()
return {
plugins: [
devServer({
entry: 'src/index.tsx',
adapter,
env,
adapter,
plugins: [
{
onServerClose: dispose
}
]
}),
build({
entry: 'src/index.tsx',
}),
],
pagesBuild()
]
}
})

0 comments on commit ce4785b

Please sign in to comment.