-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
47 lines (42 loc) · 1.15 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
import { defineConfig, Plugin } from 'vite'
import _fs from 'fs'
import path from 'path'
// import TypeDocPlugin from './vite-typedoc-plugin'
const fs = _fs.promises
export default defineConfig({
clearScreen: false,
plugins: [
//...(process.env.NETLIFY ? [] : [copyPiniaPlugin()]),
// TODO: actual plugin that works well
// TypeDocPlugin({
// name: 'Pinia',
// entryPoints: [
// path.resolve(__dirname, '../pinia/src/index.ts'),
// path.resolve(__dirname, '../testing/src/index.ts'),
// path.resolve(__dirname, '../nuxt/src/index.ts'),
// ],
// }),
],
define: {
__DEV__: 'true',
__BROWSER__: 'true',
},
optimizeDeps: {
exclude: ['vue-demi', '@vueuse/shared', '@vueuse/core', 'pinia'],
},
})
function copyPiniaPlugin(): Plugin {
return {
name: 'copy-pinia',
async generateBundle() {
const filePath = path.resolve(__dirname, '../pinia/dist/pinia.mjs')
// throws if file doesn't exist
await fs.access(filePath)
this.emitFile({
type: 'asset',
fileName: 'pinia.mjs',
source: await fs.readFile(filePath, 'utf-8'),
})
},
}
}