-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrollup.config.js
45 lines (36 loc) · 1.06 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
import babel from 'rollup-plugin-babel';
import eslint from 'rollup-plugin-eslint';
import uglify from 'rollup-plugin-uglify';
import glslify from 'rollup-plugin-glslify';
import fs from 'fs-extra';
fs.ensureDirSync( './build' );
fs.copySync( './resource', './build/resource' );
fs.copySync( './sample', './build' );
const output = [];
console.log( process.env.NODE_ENV );
if ( process.env.NODE_ENV === 'module' )
output.push( {
format: 'es',
sourcemap: true,
file: 'build/czpg.module.js',
} );
else
output.push( {
format: 'umd',
name: 'CZPG',
sourcemap: true,
file: ( process.env.NODE_ENV === 'combine' ) ? 'build/czpg.js' : 'build/czpg.min.js',
} );
const plugins = [ glslify( { basedir: 'src/shader/shadersrc/' } ), eslint() ];
if ( process.env.NODE_ENV !== 'combine' ) {
plugins.push( babel( {
exclude: 'node_modules/**',
} ) );
if ( process.env.NODE_ENV !== 'module' )
plugins.push( uglify() );
}
export default {
input: 'src/CZPG.js',
output,
plugins,
};