forked from flow/flow-for-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
60 lines (56 loc) · 1.48 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
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import progress from 'rollup-plugin-progress';
import builtinModules from 'builtin-modules';
import * as lsp from 'vscode-languageserver-protocol';
const isProduction = process.env.NODE_ENV === 'production';
const input = {
index: './lib/index.js',
flowLSP: './lib/flowLSP/index.js',
flowNonLSP: './lib/flowNonLSP/index.js',
};
const config = Object.keys(input).map(key => {
return {
input: {
[key]: input[key],
},
output: {
dir: 'build',
format: 'cjs',
sourcemap: true,
},
plugins: [
nodeResolve(),
babel({ exclude: 'node_modules/**' }),
commonjs({
namedExports: {
// vscode-languageclient uses some dynamic __export function
// for export * from ''
'vscode-languageclient': [
'TextDocumentFeature',
'RevealOutputChannelOn',
'ErrorAction',
'CloseAction',
...Object.keys(lsp),
],
},
}),
isProduction ? terser() : null,
progress(),
],
external: [
'vscode',
// contains binary files
'flow-bin',
// very slow to build
'prettier/standalone',
'prettier/parser-flow',
].concat(
// to hide builtin module warning
builtinModules
),
};
});
export default config;