forked from davidmz/apng-canvas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
59 lines (56 loc) · 1.41 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import { resolve } from 'path';
import { readFileSync } from 'fs';
// package.json を読み込む
const packageJson = JSON.parse(
readFileSync('./package.json', 'utf-8')
);
// npm package用のビルドの時のみ単一エントリーポイント
const isPackageBuild = process.env.BUILD_MODE === 'package';
export default defineConfig({
base: './', // GitHub Pages用の相対パス設定
build: isPackageBuild
? {
lib: {
entry: {
'gyeonghwon': resolve(__dirname, 'src/index.ts'),
},
formats: ['es','cjs','umd'],
name: 'gyeonghwon'
}
}
: {
outDir: 'dist',
emptyOutDir: true,
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html')
},
output: {
entryFileNames: 'assets/[name].[hash].js',
chunkFileNames: 'assets/[name].[hash].js',
assetFileNames: 'assets/[name].[hash][extname]'
}
}
},
plugins: [dts()],
json: {
stringify: true // JSONをstringifyして含める
},
server: {
open: true,
strictPort: true
},
publicDir: 'public',
appType: 'spa',
define: {
'import.meta.env.APP_VERSION': JSON.stringify(packageJson.version)
},
resolve: {
alias: {
'@': resolve(__dirname, './src')
}
},
assetsInclude: ['assets/**/*']
});