-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
40 lines (37 loc) · 989 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
36
37
38
39
40
const { babel } = require('@rollup/plugin-babel');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const { default: typescript } = require('@rollup/plugin-typescript');
const { default: dotenv } = require('rollup-plugin-dotenv');
const extensions = ['.ts', '.js'];
const preventThreeShakingPlugin = () => {
return {
name: 'no-threeshaking',
resolveId(id, importer) {
// let's not theeshake entry points, as we're not exporting anything in App Scripts
if (!importer) return { id, moduleSideEffects: 'no-treeshake' };
},
};
};
module.exports = {
input: 'src/index.ts',
output: [
{
dir: 'build',
format: 'cjs',
},
],
plugins: [
typescript({ tsconfig: './tsconfig.build.json' }),
preventThreeShakingPlugin(),
nodeResolve({
extensions,
mainFields: ['jsnext:main', 'main'],
}),
babel({
extensions,
babelHelpers: 'runtime',
comments: false,
}),
dotenv(),
],
};