-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
71 lines (62 loc) · 1.36 KB
/
vite.config.js
File metadata and controls
71 lines (62 loc) · 1.36 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
62
63
64
65
66
67
68
69
70
71
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
const osanoPlugin = () => ({
name: 'inject-osano',
apply: 'build',
transformIndexHtml: {
order: 'pre',
handler: () => [
{
tag: 'style',
children: '.osano-cm-widget{display: none;}',
injectTo: 'head',
},
{
tag: 'script',
attrs: {
src: 'https://cmp.osano.com/AzqB4OUPPVD5j8EeT/bc796e8a-d3d4-4a74-b9c7-f737cbc3379b/osano.js',
},
injectTo: 'body',
},
],
},
});
export default defineConfig({
build: {
// Match CRA build output directory.
outDir: 'build',
},
// Match CRA environment variable prefix.
envPrefix: 'REACT_APP_',
// Transform .js files as if they were .jsx files.
esbuild: {
loader: 'jsx',
include: /.*\.jsx?$/,
exclude: []
},
optimizeDeps: {
// Transform dependencies .js files as if they were .jsx files.
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
plugins: [
react(),
// Match CRA SVG transformation.
svgr({
include: '**/*.svg',
exclude: '**/*.svg?url',
svgrOptions: {
exportType: 'named',
namedExport: 'ReactComponent',
},
}),
osanoPlugin(),
],
server: {
port: Number(process.env.PORT) || 9000,
},
});