build: e33c3ecd-6e30-4f54-947f-6e498f5888d3
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { defineConfig, type Plugin } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
const injectRouterBasename: Plugin = {
|
||||
name: 'inject-router-basename',
|
||||
enforce: 'pre',
|
||||
transform(code, id) {
|
||||
if (!/\.[jt]sx$/.test(id)) return null;
|
||||
const next = code.replace(
|
||||
/<IonReactRouter(?![^>]*basename)([^>]*)>/g,
|
||||
'<IonReactRouter$1 basename={import.meta.env.BASE_URL}>',
|
||||
);
|
||||
return next === code ? null : next;
|
||||
},
|
||||
};
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [injectRouterBasename, react()],
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 8100,
|
||||
allowedHosts: true,
|
||||
hmr: {
|
||||
clientPort: process.env.HMR_CLIENT_PORT
|
||||
? parseInt(process.env.HMR_CLIENT_PORT)
|
||||
: undefined,
|
||||
},
|
||||
},
|
||||
css: { devSourcemap: false },
|
||||
});
|
||||
Reference in New Issue
Block a user