-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.mts
66 lines (64 loc) · 1.49 KB
/
vite.config.mts
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
import type {} from 'vitest/config'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import { externals } from 'rollup-plugin-node-externals'
export default defineConfig({
define: {
'import.meta.vitest': false,
},
resolve: {
alias: {
crypto: 'crypto-js',
'@/': `${__dirname}/src/`,
},
},
build: {
minify: process.env.BUILD_TARGET_ENV === 'production',
emptyOutDir: process.env.BUILD_TARGET_ENV === 'production',
lib: {
entry: {
index: 'src/index.ts',
'expr-webgl': 'src/index-expr-webgl.ts',
'ext-brush': 'src/index-ext-brush.ts',
'ext-ink': 'src/index-ext-ink.ts',
'ext-filter': 'src/index-ext-filter.ts',
'math-utils': 'src/index-math-utils.ts',
extras: 'src/index-extras.ts',
},
name: 'PapCore',
formats: ['es', 'cjs'],
fileName: (format, entryName) => {
console.log(entryName)
return `${entryName}.${format === 'es' ? 'mjs' : 'js'}`
},
},
rollupOptions: {
output: {
exports: 'auto',
},
},
},
plugins: [
{
enforce: 'pre',
...externals({
builtins: false,
exclude: [
'mitt',
'three',
'abs-svg-path',
'is-ios',
'fast-random',
// '@paplico/shared-lib',
],
}),
} as any,
dts({
rollupTypes: false,
}),
],
test: {
globals: true,
includeSource: ['src/**/*{.spec.ts,.ts}'],
},
})