-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
49 lines (42 loc) · 1.12 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
import pkg from './package.json';
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-es';
const prod = process.env.BUILD === 'prod';
const format = process.env.FORMAT || 'umd';
const entry = `src/index.js`;
const suffix = prod ? `.min` : '';
const suffixFormat = format !== 'umd' ? `.${format}` : '';
const dest = `bin/pixi-json${suffixFormat}${suffix}.js`;
const plugins = [
resolve(),
babel({
exclude: 'node_modules/**',
}),
];
if (prod) {
plugins.push(uglify({
mangle: true,
compress: true,
}, minify));
}
const compiled = (new Date()).toUTCString().replace(/GMT/g, 'UTC');
const banner = `/*!
* ${pkg.name} - v${pkg.version}
* Compiled ${compiled}
*
* pixi-json is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/\n`;
export default {
banner,
format,
intro: `if (typeof PIXI === 'undefined') { throw 'PixiJS is required'; }`,
outro: ``,
entry,
dest,
sourceMap: true,
moduleName: `__pixiJson`,
plugins,
};