Files
spacedrive/apps/desktop/vite.config.ts
Brendan Allan 872cef9f4d standardise vite configs (#662)
* standardise vite configs

* remove storybook from @sd/ui

* update pnpm lock
2023-03-31 04:08:22 -07:00

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]
});