forked from sveltejs/language-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
73 lines (72 loc) · 2.64 KB
/
rollup.config.js
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
68
69
70
71
72
73
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import cleanup from 'rollup-plugin-cleanup';
import copy from 'rollup-plugin-copy';
import builtins from 'builtin-modules';
export default [
{
input: 'src/index.ts',
output: [
{
sourcemap: false,
format: 'cjs',
file: 'dist/src/index.js'
}
],
plugins: [
replace({
// This replace-step is a hacky workaround to not transform the dynamic
// requires inside importPackage.ts of svelte-language-server in any way
'return require(dynamicFileToRequire);': 'return "XXXXXXXXXXXXXXXXXXXXX";',
delimiters: ['', '']
}),
resolve({ browser: false, preferBuiltins: true }),
commonjs(),
json(),
typescript(),
replace({
// This replace-step is a hacky workaround to not transform the dynamic
// requires inside importPackage.ts of svelte-language-server in any way
'return "XXXXXXXXXXXXXXXXXXXXX";': 'return require(dynamicFileToRequire);',
delimiters: ['', '']
}),
cleanup({ comments: ['some', 'ts', 'ts3s'] }),
copy({
targets: [
// copy over d.ts files of svelte2tsx
{
src: [
// workspace
'../../node_modules/svelte2tsx/svelte*.d.ts',
// standalone
'node_modules/svelte2tsx/svelte*.d.ts'
],
dest: 'dist/src'
}
]
})
],
watch: {
clearScreen: false
},
external: [
...builtins,
// svelte-check dependencies that are system-dependent and should
// be installed as dependencies through npm
'picocolors',
'chokidar',
// Dependencies of svelte-language-server
// we don't want to bundle and instead require them as dependencies
'typescript',
'sade',
'svelte',
'svelte/compiler',
'svelte-preprocess',
'import-fresh', // because of https://github.com/sindresorhus/import-fresh/issues/18
'@jridgewell/trace-mapping'
]
}
];