forked from UMassCDS/roostui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
68 lines (62 loc) · 2.02 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
61
62
63
64
65
66
67
68
import sourcemaps from 'rollup-plugin-sourcemaps';
import buble from '@rollup/plugin-buble';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';
import replace from 'rollup-plugin-replace';
import { uglify } from 'rollup-plugin-uglify';
import {join} from 'path';
import babel from '@rollup/plugin-babel';
const PRODUCTION = process.env['BUILD'] === 'production';
export default {
input: join('js', 'vis.js'),
output: {
file: join('dist', PRODUCTION ? 'demo.min.js' : 'demo.js'),
format: 'iife',
sourcemap: true,
strict: true,
globals: {
'aws-sdk': 'AWS',
'nexrad-js': 'nexrad',
'jquery': '$'
},
},
external: ['aws-sdk', 'nexrad-js'],
plugins: [
sourcemaps(),
PRODUCTION && uglify(),
babel({
exclude: 'node_modules/**',
babelHelpers: 'runtime'
}),
resolve({
// use "module" field for ES6 module if possible
module: true, // Default: true
// use "jsnext:main" if possible
// – see https://github.com/rollup/rollup/wiki/jsnext:main
jsnext: true, // Default: false
// use "main" field or index.js, even if it's not an ES6 module
// (needs to be converted from CommonJS to ES6
// – see https://github.com/rollup/rollup-plugin-commonjs
main: true, // Default: true
// some package.json files have a `browser` field which
// specifies alternative files to load for people bundling
// for the browser. If that's you, use this option, otherwise
// pkg.browser will be ignored
browser: true // Default: false
}),
commonjs({
namedExports: {
'react-dom': ['render'],
'react': ['Component', 'createElement']
}
}),
builtins(),
replace({
// Production for production builds.
'process.env.NODE_ENV': JSON.stringify(PRODUCTION ? 'production' : 'development' )
}),
globals()
].filter(Boolean)
};