reverted config change
This commit is contained in:
parent
1d6cd19bab
commit
797e9bac4f
1 changed files with 41 additions and 50 deletions
|
|
@ -1,58 +1,49 @@
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import dotenv from 'dotenv';
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({mode}) => {
|
export default defineConfig({
|
||||||
// Load env variables
|
plugins: [react()],
|
||||||
const env = loadEnv(mode, process.cwd(), '');
|
resolve: {
|
||||||
|
alias: {
|
||||||
// Determine HMR host based on environment
|
'@': path.resolve(__dirname, 'src'),
|
||||||
const isProduction = process.env.ENVIRONMENT === "prod";
|
'@components': path.resolve(__dirname, 'src/components'),
|
||||||
const hmrHost = isProduction ? 'rocks.2many.ca' : 'localhost';
|
'@features': path.resolve(__dirname, 'src/features'),
|
||||||
const hmrConfig = isProduction
|
'@hooks': path.resolve(__dirname, 'src/hooks'),
|
||||||
? { host: hmrHost }
|
'@layouts': path.resolve(__dirname, 'src/layouts'),
|
||||||
: { host: hmrHost, clientPort: 3000 };
|
'@pages': path.resolve(__dirname, 'src/pages'),
|
||||||
return {
|
'@services': path.resolve(__dirname, 'src/services'),
|
||||||
plugins: [react()],
|
'@store': path.resolve(__dirname, 'src/store'),
|
||||||
resolve: {
|
'@theme': path.resolve(__dirname, 'src/theme'),
|
||||||
alias: {
|
'@utils': path.resolve(__dirname, 'src/utils'),
|
||||||
'@': path.resolve(__dirname, 'src'),
|
'@assets': path.resolve(__dirname, 'src/assets')
|
||||||
'@components': path.resolve(__dirname, 'src/components'),
|
|
||||||
'@features': path.resolve(__dirname, 'src/features'),
|
|
||||||
'@hooks': path.resolve(__dirname, 'src/hooks'),
|
|
||||||
'@layouts': path.resolve(__dirname, 'src/layouts'),
|
|
||||||
'@pages': path.resolve(__dirname, 'src/pages'),
|
|
||||||
'@services': path.resolve(__dirname, 'src/services'),
|
|
||||||
'@store': path.resolve(__dirname, 'src/store'),
|
|
||||||
'@theme': path.resolve(__dirname, 'src/theme'),
|
|
||||||
'@utils': path.resolve(__dirname, 'src/utils'),
|
|
||||||
'@assets': path.resolve(__dirname, 'src/assets')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
server: {
|
|
||||||
// port: 3000,
|
|
||||||
// proxy: {
|
|
||||||
// '/api': {
|
|
||||||
// target: 'http://localhost:4000',
|
|
||||||
// changeOrigin: true,
|
|
||||||
// secure: false
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
allowedHosts: ['localhost', 'rocks.2many.ca'],
|
|
||||||
host: '0.0.0.0',
|
|
||||||
port: 3000,
|
|
||||||
watch: {
|
|
||||||
usePolling: true,
|
|
||||||
},
|
|
||||||
hmr: hmrConfig
|
|
||||||
},
|
|
||||||
build: {
|
|
||||||
outDir: 'dist',
|
|
||||||
assetsDir: 'assets',
|
|
||||||
emptyOutDir: true,
|
|
||||||
sourcemap: process.env.NODE_ENV !== 'production'
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
// port: 3000,
|
||||||
|
// proxy: {
|
||||||
|
// '/api': {
|
||||||
|
// target: 'http://localhost:4000',
|
||||||
|
// changeOrigin: true,
|
||||||
|
// secure: false
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
allowedHosts: ['localhost', 'rocks.2many.ca'],
|
||||||
|
host: '0.0.0.0',
|
||||||
|
port: 3000,
|
||||||
|
watch: {
|
||||||
|
usePolling: true,
|
||||||
|
},
|
||||||
|
hmr: {
|
||||||
|
clientPort: 3000,
|
||||||
|
host: 'localhost',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
outDir: 'dist',
|
||||||
|
assetsDir: 'assets',
|
||||||
|
emptyOutDir: true,
|
||||||
|
sourcemap: process.env.NODE_ENV !== 'production'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Loading…
Reference in a new issue