mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-20 06:28:14 -04:00
25 lines
623 B
TypeScript
25 lines
623 B
TypeScript
import { Plugin, mergeConfig } from 'vite';
|
|
import baseConfig from '../../packages/config/vite';
|
|
|
|
const devtoolsPlugin: Plugin = {
|
|
name: 'devtools-plugin',
|
|
transformIndexHtml(html) {
|
|
const isDev = process.env.NODE_ENV === 'development';
|
|
if (isDev) {
|
|
const devtoolsScript = `<script src="http://localhost:8097"></script>`;
|
|
const headTagIndex = html.indexOf('</head>');
|
|
if (headTagIndex > -1) {
|
|
return html.slice(0, headTagIndex) + devtoolsScript + html.slice(headTagIndex);
|
|
}
|
|
}
|
|
return html;
|
|
}
|
|
};
|
|
|
|
export default mergeConfig(baseConfig, {
|
|
server: {
|
|
port: 8001
|
|
},
|
|
plugins: [devtoolsPlugin]
|
|
});
|