-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
38 lines (34 loc) · 960 Bytes
/
vite.config.ts
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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import legacy from '@vitejs/plugin-legacy';
function handleModuleDirectivesPlugin() {
return {
name: 'handle-module-directives-plugin',
transform(code, id) {
if (id.includes('@vkontakte/icons')) {
code = code.replace(/"use-client";?/g, '');
}
return { code };
},
};
}
/**
* Some chunks may be large.
* This will not affect the loading speed of the site.
* We collect several versions of scripts that are applied depending on the browser version.
* This is done so that your code runs equally well on the site and in the odr.
* The details are here: https://dev.vk.com/mini-apps/development/on-demand-resources.
*/
export default defineConfig({
base: './',
plugins: [
react(),
handleModuleDirectivesPlugin(),
legacy({
targets: ['defaults', 'not IE 11'],
}),
],
build: {
outDir: 'build',
},
});