-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Salah Eddine Lalami
committed
Oct 30, 2023
1 parent
a1625bf
commit 3c5bfcc
Showing
4 changed files
with
64 additions
and
155 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,2 +1,3 @@ | ||
# to connect your frontend to remote backend server | ||
VITE_BACKEND_SERVER="http://your_backend_url_server.com/" | ||
VITE_BACKEND_SERVER="http://your_backend_url_server.com/" | ||
PROD = false |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,48 +1,60 @@ | ||
import path from 'path'; | ||
|
||
// import { defineConfig, loadEnv } from 'vite'; | ||
import { defineConfig, loadEnv } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
import { defineConfig } from 'vite'; | ||
|
||
// https://vitejs.dev/config/ | ||
// export default ({ mode }) => { | ||
// process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; | ||
// const config = { | ||
// plugins: [react()], | ||
// resolve: { | ||
// base: '/', | ||
// alias: { | ||
// '@': path.resolve(__dirname, 'src'), | ||
// }, | ||
// }, | ||
// server: { | ||
// proxy: { | ||
// '/api': { | ||
// target: 'http://dev-server.idurarapp.com/', | ||
// changeOrigin: false, | ||
// secure: false, | ||
// }, | ||
// }, | ||
// }, | ||
// }; | ||
// return defineConfig(config); | ||
// }; | ||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
resolve: { | ||
base: '/', | ||
alias: { | ||
'@': path.resolve(__dirname, 'src'), | ||
export default ({ mode }) => { | ||
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; | ||
const config = { | ||
plugins: [react()], | ||
resolve: { | ||
base: '/', | ||
alias: { | ||
'@': path.resolve(__dirname, 'src'), | ||
}, | ||
}, | ||
}, | ||
server: { | ||
proxy: { | ||
'/api': { | ||
target: 'http://dev-server.idurarapp.com/', | ||
changeOrigin: true, | ||
// rewrite: (path) => path.replace(/^\/api/, ''), | ||
server: { | ||
proxy: { | ||
'/api': { | ||
target: process.env.VITE_BACKEND_SERVER, | ||
changeOrigin: true, | ||
secure: false, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}; | ||
return defineConfig(config); | ||
}; | ||
// https://vitejs.dev/config/ | ||
|
||
// export default defineConfig(({ command, mode }) => { | ||
// // Load env file based on `mode` in the current working directory. | ||
// // Set the third parameter to '' to load all env regardless of the `VITE_` prefix. | ||
// const env = loadEnv(mode, process.cwd(), ''); | ||
// return { | ||
// // vite config | ||
// define: { | ||
// __APP_ENV__: JSON.stringify(env.APP_ENV), | ||
// }, | ||
// }; | ||
// }); | ||
|
||
// export default defineConfig({ | ||
// plugins: [react()], | ||
// resolve: { | ||
// base: '/', | ||
// alias: { | ||
// '@': path.resolve(__dirname, 'src'), | ||
// }, | ||
// }, | ||
// server: { | ||
// proxy: { | ||
// '/api': { | ||
// target: import.meta.env.VITE_BACKEND_SERVER, | ||
// changeOrigin: true, | ||
// secure: false, | ||
// }, | ||
// }, | ||
// }, | ||
// }); |