|
1 |
| -import path from 'node:path' |
2 |
| -import { defineConfig } from 'vite' |
3 |
| -import Dts from 'vite-plugin-dts' |
4 |
| - |
5 |
| -export default defineConfig({ |
6 |
| - plugins: [ |
7 |
| - { |
8 |
| - name: 'replace constants', |
9 |
| - enforce: 'pre', |
10 |
| - transform: { |
11 |
| - order: 'pre', |
12 |
| - handler(code, id) { |
13 |
| - if (id.endsWith('.mjs')) { |
14 |
| - return code |
15 |
| - .replaceAll(`getCurrentInstance()`, `null`) |
16 |
| - .replaceAll(`getLifeCycleTarget()`, `null`) |
17 |
| - } |
18 |
| - }, |
19 |
| - }, |
20 |
| - }, |
21 |
| - Dts({ |
22 |
| - include: [ |
23 |
| - './src/**/*.ts', |
24 |
| - './tsconfig.json', |
25 |
| - './shim.d.ts', |
26 |
| - ], |
27 |
| - rollupTypes: true, |
28 |
| - bundledPackages: ['@vueuse/core', '@vueuse/shared'], |
29 |
| - beforeWriteFile(_, content) { |
30 |
| - return { |
31 |
| - content: content.replaceAll('\'vue-demi\'', '\'@reactive-vscode/reactivity\''), |
32 |
| - } |
33 |
| - }, |
34 |
| - }), |
35 |
| - ], |
36 |
| - resolve: { |
37 |
| - alias: { |
38 |
| - 'vue-demi': path.resolve(__dirname, './src/vue-demi.ts'), |
39 |
| - }, |
40 |
| - }, |
41 |
| - build: { |
42 |
| - lib: { |
43 |
| - entry: 'src/index.ts', |
44 |
| - formats: ['es'], |
45 |
| - fileName: 'index', |
46 |
| - }, |
47 |
| - rollupOptions: { |
48 |
| - external: ['@reactive-vscode/reactivity'], |
49 |
| - }, |
50 |
| - minify: false, |
51 |
| - }, |
52 |
| -}) |
| 1 | +import path from 'node:path' |
| 2 | +import { defineConfig } from 'vite' |
| 3 | +import Dts from 'vite-plugin-dts' |
| 4 | + |
| 5 | +export default defineConfig({ |
| 6 | + plugins: [ |
| 7 | + { |
| 8 | + name: 'replace constants', |
| 9 | + enforce: 'pre', |
| 10 | + transform: { |
| 11 | + order: 'pre', |
| 12 | + handler(code, id) { |
| 13 | + if (id.endsWith('.mjs')) { |
| 14 | + return code |
| 15 | + .replaceAll(`getCurrentInstance()`, `null`) |
| 16 | + .replaceAll(`getLifeCycleTarget()`, `null`) |
| 17 | + } |
| 18 | + }, |
| 19 | + }, |
| 20 | + }, |
| 21 | + Dts({ |
| 22 | + include: [ |
| 23 | + './src/**/*.ts', |
| 24 | + './tsconfig.json', |
| 25 | + './shim.d.ts', |
| 26 | + ], |
| 27 | + rollupTypes: true, |
| 28 | + bundledPackages: ['@vueuse/core', '@vueuse/shared'], |
| 29 | + beforeWriteFile(_, content) { |
| 30 | + return { |
| 31 | + content: content.replaceAll('\'vue-demi\'', '\'@reactive-vscode/reactivity\''), |
| 32 | + } |
| 33 | + }, |
| 34 | + }), |
| 35 | + ], |
| 36 | + resolve: { |
| 37 | + alias: { |
| 38 | + 'vue-demi': path.resolve(__dirname, './src/vue-demi.ts'), |
| 39 | + }, |
| 40 | + }, |
| 41 | + build: { |
| 42 | + lib: { |
| 43 | + entry: 'src/index.ts', |
| 44 | + formats: ['es', 'cjs'], |
| 45 | + fileName: 'index', |
| 46 | + }, |
| 47 | + rollupOptions: { |
| 48 | + external: ['@reactive-vscode/reactivity'], |
| 49 | + }, |
| 50 | + minify: false, |
| 51 | + }, |
| 52 | +}) |
0 commit comments