-
-
Notifications
You must be signed in to change notification settings - Fork 531
Expand file tree
/
Copy pathrolldown.config.ts
More file actions
67 lines (66 loc) · 1.65 KB
/
rolldown.config.ts
File metadata and controls
67 lines (66 loc) · 1.65 KB
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
67
import * as fs from 'node:fs';
import * as path from 'node:path';
import { defineConfig } from 'rolldown';
export default defineConfig({
input: {
'extension': './src/extension.ts',
'reactivity-analysis-plugin': './src/reactivityAnalysisPlugin.ts',
'language-server': './node_modules/@vue/language-server/index.ts',
'typescript-plugin': './node_modules/@vue/typescript-plugin/index.ts',
},
output: {
format: 'cjs',
minify: true,
},
transform: {
define: {
'process.env.NODE_ENV': '"production"',
},
},
checks: {
eval: false,
},
external: ['vscode'],
plugins: [
{
name: 'clean',
buildStart() {
fs.rmSync(path.resolve(__dirname, './dist'), { recursive: true, force: true });
},
},
{
name: 'copy-types',
buildEnd() {
const sourceDir = path.resolve(__dirname, '../../packages/language-core/types');
const targetDir = path.resolve(__dirname, './types');
fs.rmSync(targetDir, { recursive: true, force: true });
fs.cpSync(sourceDir, targetDir, { recursive: true });
},
},
{
name: 'umd2esm',
resolveId: {
filter: {
id: /^(vscode-.*-languageservice|vscode-languageserver-types|jsonc-parser)$/,
},
handler(source, importer) {
const pathUmdMay = require.resolve(source, { paths: [importer!] });
// Call twice the replace is to solve the problem of the path in Windows
const pathEsm = pathUmdMay.replace('/umd/', '/esm/').replace('\\umd\\', '\\esm\\');
return { id: pathEsm };
},
},
},
{
name: 'typescript',
resolveId: {
filter: {
id: /^typescript$/,
},
handler() {
return { id: 'typescript', external: true };
},
},
},
],
});