-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.rollup.config.js
More file actions
90 lines (85 loc) · 2.8 KB
/
app.rollup.config.js
File metadata and controls
90 lines (85 loc) · 2.8 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
/**
* Configuration file for RollupJS module builder.
*
* This configuration file includes the ols_core project libraries that
* are referenced in the core/index.ts file.
*
*/
import typescript from 'rollup-plugin-typescript';
import resolve from 'rollup-plugin-node-resolve';
import angular from 'rollup-plugin-angular';
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';
import rollup_definitions from './global-definitions.js';
export default {
/**
* the entry point where all the linrary includes are listed
*/
entry: 'source/main.browser.ts',
/**
* merged outputfile
*/
dest: 'dist/app.es5.js',
/**
* Types of bundle format
*/
format: 'iife',
/**
* Global variable name of the library files. Refer to globals definitions on how to access them from project modules.
* NOTE: you can also type in the variable name of the browser console to see the actual function.
*/
moduleName: 'app',
/**
* Add source map
*/
sourceMap: true,
/**
* Method to call when there is an warning thrown by rollup.
*/
onwarn: function(msg) {
/**
* Lets not flood the consle with that stupid warning!
*
* According to google, we can happily ignore this warning:
*/
let message = msg.message != undefined ? msg.message : msg;
if (!message.includes("The 'this' keyword is equivalent to 'undefined' at the top level of an ES module")) {
console.log(msg.message);
}
},
/**
* Global variable names that are defined in this bundle. Feature and app bundles should use the following definitions in their
* respective rollup config files.
*
* On the same note - in the feature and app modules, these global variable names should be registered as external dependencies.
*/
globals: function(id) {
if (rollup_definitions.rollup_globals_definitions[id]) {
// console.log("Registered as global - " + id + " -> " + rollup_definitions.rollup_globals_definitions[id]);
return rollup_definitions.rollup_globals_definitions[id];
}
else {
console.log("Not registered in global definitions! -> " + id);
}
},
external: function(id) {
var external_dep = false;
if (id.startsWith("@angular/") || id.startsWith("rxjs/") || id.startsWith("Reflect") || id.startsWith("reflect-metadata")) {
external_dep = true;
}
return external_dep;
},
plugins: [
angular(),
typescript({
typescript: require('typescript')
}),
resolve({
jsnext: true,
main: true,
browser: true
}),
commonjs(),
uglify()
]
}