This repository was archived by the owner on Mar 29, 2023. It is now read-only.
forked from playcanvas/pcui-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
91 lines (85 loc) · 2.44 KB
/
rollup.config.js
File metadata and controls
91 lines (85 loc) · 2.44 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import resolve from 'rollup-plugin-node-resolve';
import { uglify } from 'rollup-plugin-uglify';
import postcss from 'rollup-plugin-postcss';
import commonjs from '@rollup/plugin-commonjs';
import { babel } from '@rollup/plugin-babel';
import jscc from 'rollup-plugin-jscc';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';
const umdBuild = {
input: 'src/index.js',
output: {
file: 'dist/index.js',
format: 'umd',
name: 'pcuiGraph',
globals: {
'@playcanvas/observer': 'observer',
'@playcanvas/pcui': 'pcui'
}
},
external: ['@playcanvas/observer', '@playcanvas/pcui'],
plugins: [
jscc({
values: { _STRIP_SCSS: process.env.STRIP_SCSS }
}),
postcss({
minimize: false,
extensions: ['.css', '.scss']
}),
commonjs({ transformMixedEsModules: true }),
globals(),
builtins(),
babel({ babelHelpers: 'bundled' }),
resolve(),
process.env.NODE_ENV === 'production' && uglify()
]
};
const moduleBuild = {
input: 'src/index.js',
output: {
file: 'dist/index.mjs',
format: 'module'
},
external: ['@playcanvas/observer', '@playcanvas/pcui'],
plugins: [
commonjs({ transformMixedEsModules: true }),
globals(),
builtins(),
babel({ babelHelpers: 'bundled' }),
postcss({
minimize: false,
extensions: ['.css', '.scss']
}),
resolve(),
process.env.NODE_ENV === 'production' && uglify()
]
};
const bundleBuild = {
input: 'src/index.js',
output: {
file: 'dist/bundle.mjs',
format: 'module'
},
plugins: [
commonjs({ transformMixedEsModules: true }),
globals(),
builtins(),
babel({ babelHelpers: 'bundled' }),
postcss({
minimize: false,
extensions: ['.css', '.scss']
}),
resolve(),
process.env.NODE_ENV === 'production' && uglify()
]
};
let targets;
if (process.env.target) {
switch (process.env.target.toLowerCase()) {
case "umd": targets = [umdBuild]; break;
case "module": targets = [moduleBuild]; break;
case "bundle": targets = [bundleBuild]; break;
case "all": targets = [umdBuild, moduleBuild, bundleBuild]; break;
}
}
export default targets;