-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
61 lines (57 loc) · 1.56 KB
/
vite.config.js
File metadata and controls
61 lines (57 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import {defineConfig} from 'vite'
import react from '@vitejs/plugin-react-swc'
import image from '@rollup/plugin-image';
const DEV_UI_SCRIPT = `
import {
breadcrumbs,
footer,
footerMenus,
header,
qaBot,
siteMenus,
tableOfContents,
universalMenuItems,
universalMenus,
} from "https://unpkg.com/@access-ci/ui@0.18.1/dist/access-ci-ui.js";
window.ACCESS_CI_UI = {
breadcrumbs,
footer,
footerMenus,
header,
qaBot,
siteMenus,
tableOfContents,
universalMenuItems,
universalMenus,
};
`;
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
image(),
{
name: 'inject-dev-only-ui',
apply: 'serve', // ⚡️ Only applies during local development
transformIndexHtml(html) {
return html.replace(
'</head>',
`<script type="module">${DEV_UI_SCRIPT}</script></head>`
);
}
}
],
build: {
assetsInlineLimit: 100000000,
rollupOptions: {
output: {
dir: './build',
// Disable code splitting and create a single entry file
manualChunks: false,
inlineDynamicImports: true,
entryFileNames: `[name].js`, // Customize the output filename
assetFileNames: `[name].[ext]`, // Customize asset filenames (e.g., CSS)
},
},
},
})