-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.js
51 lines (47 loc) · 1.25 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
/**
* Dependencies
*/
const nodeResolve = require('@rollup/plugin-node-resolve'); // Locate modules using the Node resolution algorithm, for using third party modules in node_modules.
const replace = require('@rollup/plugin-replace'); // Replace content while bundling.
const path = require('path');
const resolve = require(path.join(__dirname, '../', 'bin/util/resolve'));
const global = resolve('config/global');
/**
* Plugin configuration. Refer to the package for details on the available options.
*
* @source https://github.com/rollup/plugins
*
* @type {Object}
*/
let plugins = [
replace({
'preventAssignment': true,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
nodeResolve.nodeResolve({
browser: true,
moduleDirectories: [
'node_modules'
]
})
];
/**
* ES Module Exports
*
* @type {Array}
*/
module.exports = [
{
input: path.join(global.base, global.src, global.entry.scripts),
cache: true,
output: [{
file: path.join(global.base, global.dist, global.entry.scripts),
name: global.entry.name,
sourcemap: (process.env.NODE_ENV === 'production') ? false : 'inline',
format: 'iife',
strict: true
}],
plugins: plugins,
devModule: true
}
];