-
Notifications
You must be signed in to change notification settings - Fork 4
/
rollup.js
51 lines (49 loc) · 1.17 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');
const replace = require('@rollup/plugin-replace');
const path = require('path');
const global = require('./global');
const pkg = require('../package.json');
/**
* Plugin configuration. Refer to the package for details on the available options.
*
* @source https://github.com/rollup/plugins
*
* @type {Object}
*/
let plugins = [
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'CDN_BASE': JSON.stringify(pkg.cdn.base.raw),
'CDN': JSON.stringify(pkg.cdn.content[process.env.NODE_ENV])
}),
nodeResolve.nodeResolve({
browser: true,
customResolveOption: {
moduleDirectories: [
'node_modules'
]
}
})
];
/**
* ES Module Exports
*
* @type {Array}
*/
module.exports = [
{
input: path.join(global.base, global.src, global.entry.scripts),
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
}
];