-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
36 lines (29 loc) · 865 Bytes
/
vite.config.js
File metadata and controls
36 lines (29 loc) · 865 Bytes
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
import { resolve } from 'path';
import { splitVendorChunkPlugin } from 'vite';
import dts from 'vite-plugin-dts';
const PROJECT_DIR = resolve(__dirname);
const SRC_DIR = resolve(PROJECT_DIR, 'src');
const OUT_DIR = resolve(PROJECT_DIR, 'dist');
const STATIC_DIR = resolve(PROJECT_DIR, 'static');
const isProd = 'production' === process.env.NODE_ENV;
export default {
publicDir: STATIC_DIR,
define: {
// Inject `package.json`::`version` into `import.meta.env.PACKAGE_VERSION`
'import.meta.env.PACKAGE_VERSION': JSON.stringify(process.env.npm_package_version)
},
plugins: [
splitVendorChunkPlugin(),
// Generate type declarations
dts({
include: [SRC_DIR],
outDir: resolve(OUT_DIR, 'types'),
rollupTypes: isProd
})
],
// Necessary for running within Docker
server: {
cors: true,
host: true
}
};