-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rollup.js
39 lines (34 loc) · 1005 Bytes
/
.rollup.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
import { babel } from '@rollup/plugin-babel';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import { resolve } from 'path';
import typescript from 'rollup-plugin-typescript2';
const extensions = ['.ts', '.js'];
const preventTreeShakingPlugin = {
name: 'no-threeshaking',
resolveId: (id, importer) => (importer ? null : { id, moduleSideEffects: 'no-treeshake' }),
};
const isGithub = process.env.ENV === 'GITHUB';
const minified = {
comments: false,
compact: true,
minified: true,
};
/** @type {import('rollup').RollupOptions} */
const config = {
input: './.build/index.ts',
output: { dir: '.build', format: 'esm' },
plugins: [
preventTreeShakingPlugin,
nodeResolve({ extensions }),
typescript(),
babel({
extensions,
babelHelpers: 'runtime',
include: resolve('.build', 'src', '**', '*.ts'),
exclude: ['node_modules/**'],
configFile: './.babelrc.js',
...(isGithub ? minified : {}),
}),
],
};
export default config;