mirror of
https://github.com/Afilmory/afilmory
synced 2026-04-24 23:05:05 +00:00
feat: add build:serve script and update build:web command for server serving, fixed #147
Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"analyze": "analyzer=1 vite build",
|
"analyze": "analyzer=1 vite build",
|
||||||
"build": "tsx scripts/build.ts",
|
"build": "tsx scripts/build.ts",
|
||||||
|
"build:serve": "BUILD_FOR_SERVER_SERVE=1 vite build",
|
||||||
"dev": "tsx scripts/dev.ts",
|
"dev": "tsx scripts/dev.ts",
|
||||||
"format": "prettier --write \"src/**/*.ts\" ",
|
"format": "prettier --write \"src/**/*.ts\" ",
|
||||||
"lint": "eslint --fix",
|
"lint": "eslint --fix",
|
||||||
@@ -109,4 +110,4 @@
|
|||||||
"vite-plugin-html": "3.2.2",
|
"vite-plugin-html": "3.2.2",
|
||||||
"vite-plugin-pwa": "1.1.0"
|
"vite-plugin-pwa": "1.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,12 +48,11 @@ const ReactCompilerConfig = {
|
|||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const BUILD_FOR_SERVER_SERVE = process.env.BUILD_FOR_SERVER_SERVE === '1'
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ command }) => {
|
export default defineConfig(() => {
|
||||||
const isBuild = command === 'build'
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: isBuild ? '/static/web/' : '/',
|
base: BUILD_FOR_SERVER_SERVE ? '/static/web/' : '/',
|
||||||
plugins: [
|
plugins: [
|
||||||
codeInspectorPlugin({
|
codeInspectorPlugin({
|
||||||
bundler: 'vite',
|
bundler: 'vite',
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"build:web": "AFILMORY_EMBED_MANIFEST=false pnpm --filter @afilmory/web build",
|
"build:web": "AFILMORY_EMBED_MANIFEST=false BUILD_FOR_SERVER_SERVE=1 pnpm --filter @afilmory/web build",
|
||||||
"db:generate": "pnpm -C ../../packages/db db:generate",
|
"db:generate": "pnpm -C ../../packages/db db:generate",
|
||||||
"db:migrate": "pnpm -C ../../packages/db db:migrate",
|
"db:migrate": "pnpm -C ../../packages/db db:migrate",
|
||||||
"db:studio": "pnpm -C ../../packages/db db:studio",
|
"db:studio": "pnpm -C ../../packages/db db:studio",
|
||||||
|
|||||||
Reference in New Issue
Block a user