-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f714f5c
commit 5c288df
Showing
1 changed file
with
33 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,36 @@ | ||
import { defineConfig, loadEnv } from "vite"; | ||
import react from "@vitejs/plugin-react"; | ||
import { defineConfig, loadEnv } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
import compressionPlugin from 'vite-plugin-compression'; | ||
|
||
//https://vitejs.dev/config/#using-environment-variables-in-config | ||
const env = loadEnv('',''); | ||
const api_url = JSON.stringify(env.VITE_API_URL); | ||
export default defineConfig(({ mode }) => { | ||
const env = loadEnv(mode, process.cwd()); | ||
const api_url = env.VITE_API_URL; | ||
|
||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
build: { | ||
outDir: "build" | ||
}, | ||
server: { | ||
proxy: { | ||
"/api": { | ||
target: api_url, | ||
changeOrigin: true, | ||
}, | ||
} | ||
}, | ||
test: { | ||
globals: true, | ||
environment: "jsdom", | ||
setupFiles: "./test/setup.js", | ||
passWithNoTests: true | ||
}, | ||
return { | ||
plugins: [ | ||
react(), | ||
compressionPlugin({ | ||
disable: true, // Disable or configure appropriately | ||
}) | ||
], | ||
build: { | ||
outDir: 'build', | ||
sourcemap: true, | ||
}, | ||
server: { | ||
proxy: { | ||
'/api/': { | ||
target: api_url, | ||
changeOrigin: true, | ||
rewrite: path => path.replace(/^\/api/, ''), | ||
}, | ||
} | ||
}, | ||
test: { | ||
globals: true, | ||
environment: 'jsdom', | ||
setupFiles: './test/setup.js', | ||
passWithNoTests: true | ||
}, | ||
}; | ||
}); | ||
|
||
// import { defineConfig, loadEnv } from 'vite'; | ||
// import react from '@vitejs/plugin-react'; | ||
// import compressionPlugin from 'vite-plugin-compression'; | ||
// | ||
// export default defineConfig(({ mode }) => { | ||
// const env = loadEnv(mode, process.cwd()); | ||
// const api_url = env.VITE_API_URL; | ||
// | ||
// return { | ||
// plugins: [ | ||
// react(), | ||
// compressionPlugin({ | ||
// disable: true, // Disable or configure appropriately | ||
// }) | ||
// ], | ||
// build: { | ||
// outDir: 'build', | ||
// sourcemap: true, | ||
// }, | ||
// server: { | ||
// proxy: { | ||
// '/api/': { | ||
// target: api_url, | ||
// changeOrigin: true, | ||
// rewrite: path => path.replace(/^\/api/, ''), | ||
// }, | ||
// } | ||
// }, | ||
// test: { | ||
// globals: true, | ||
// environment: 'jsdom', | ||
// setupFiles: './test/setup.js', | ||
// passWithNoTests: true | ||
// }, | ||
// }; | ||
// }); |