40 lines
1020 B
JavaScript
40 lines
1020 B
JavaScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
|
|
import inject from '@rollup/plugin-inject';
|
|
import buildConfig from './build.config';
|
|
|
|
export default defineConfig({
|
|
appType: 'spa',
|
|
publicDir: false,
|
|
base: buildConfig.base,
|
|
server: {
|
|
port: 8082,
|
|
host: '127.0.0.1',
|
|
},
|
|
plugins: [
|
|
react()
|
|
],
|
|
optimizeDeps: {
|
|
esbuildOptions: {
|
|
define: {
|
|
global: 'globalThis',
|
|
},
|
|
plugins: [
|
|
// Enable esbuild polyfill plugins
|
|
NodeGlobalsPolyfillPlugin({
|
|
process: false,
|
|
buffer: true
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
sourcemap: true,
|
|
copyPublicDir: false,
|
|
rollupOptions: {
|
|
plugins: [inject({ Buffer: ['buffer', 'Buffer'] })],
|
|
},
|
|
},
|
|
}); |