-
Notifications
You must be signed in to change notification settings - Fork 10
/
rollup.config.js
35 lines (32 loc) · 932 Bytes
/
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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
// import { terser } from 'rollup-plugin-terser';
const production = process.env.BUILD === 'production';
function finalExport(options) {
let moduleStr = `module.exports = ${options.moduleName};`;
let varStr = `var ${options.moduleName} = {`;
let varReplaceStr = `module.exports = {`;
return {
name: 'final-export',
renderChunk (code, chunk, options) {
if (code.indexOf(moduleStr) === -1) return null;
code = code.replace(moduleStr, '');
return code.replace(varStr, varReplaceStr);
}
};
}
export default {
input: ['extension-common.js'],
output: {
file: 'out/extension-common.js',
format: 'cjs',
exports: 'default'
},
plugins: [
resolve(),
commonjs(),
finalExport({moduleName: 'extensionCommon'}),
// production && terser(),
],
external: ['vscode']
};