-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
30 lines (29 loc) · 1004 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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import { emptyDirectories } from 'rollup-plugin-app-utils';
import serve from 'rollup-plugin-serve';
import { terser } from 'rollup-plugin-terser';
import { babel } from '@rollup/plugin-babel';
const useServe = process.env.ROLLUP_SERVE === 'true';
const port = process.env.ROLLUP_PORT || 8000;
const output = useServe ? '.serve' : 'dist';
export default [
{
input: 'src/index.js',
plugins: [
emptyDirectories(output),
resolve({ jsnext: true, preferBuiltins: true, browser: true }),
commonjs(),
json(),
babel({ babelHelpers: 'bundled', presets: ['@babel/env'] }),
terser(),
].concat(useServe ? [serve({ host: 'localhost', port: port, contentBase: [output] })] : []),
output: {
name: 'JawgJSLoader',
file: `${output}/jawg-js-loader.js`,
sourcemap: useServe,
format: 'umd',
},
},
];