Skip to content

Commit a285218

Browse files
fix(bundle): Only bundle ui-router-ng2 code (do not bundle ui-router-core)
BREAKING CHANGE: We no longer bundle ui-router-core nor ui-router-rx into the UMD bundle. This change is most likely to affect: - SystemJS projects - projects that do not bundle (but ship pre-built UMD bundles) - Users of ui-router plugins that import ui-router-core, such as sticky-states.
1 parent 89884b9 commit a285218

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ui-router-ng2",
33
"description": "State-based routing for Angular 2",
4-
"version": "1.0.0-beta.4",
4+
"version": "1.0.0-beta.5",
55
"scripts": {
66
"clean": "shx rm -rf lib lib-esm _bundles _dec",
77
"compile": "npm run clean && ngc",
@@ -39,7 +39,7 @@
3939
"module": "lib/index.js",
4040
"typings": "lib/index.d.ts",
4141
"dependencies": {
42-
"ui-router-core": "=4.0.0",
42+
"ui-router-core": "=5.0.0",
4343
"ui-router-rx": "=0.2.1"
4444
},
4545
"peerDependencies": {

rollup.config.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ uglifyOpts.output.comments = (node, comment) =>
2222
comment.type === 'comment2' && /@license/i.test(comment.value);
2323

2424
let plugins = [
25-
nodeResolve({jsnext: true}),
25+
nodeResolve({ jsnext: true }),
2626
progress(),
2727
sourcemaps(),
2828
commonjs(),
@@ -41,9 +41,14 @@ function onwarn(warning) {
4141
}
4242

4343
function isExternal(id) {
44+
// ui-router-core and ui-router-rx should be external
4445
// All rxjs and @angular/* should be external
4546
// except for @angular/router/src/router_config_loader
46-
let externals = [ /^rxjs/, /^@angular\/(?!router\/src\/router_config_loader)/, ];
47+
let externals = [
48+
/^ui-router-(core|rx)/,
49+
/^rxjs/,
50+
/^@angular\/(?!router\/src\/router_config_loader)/,
51+
];
4752
return externals.map(regex => regex.exec(id)).reduce((acc, val) => acc || !!val, false);
4853
}
4954

@@ -89,6 +94,8 @@ const CONFIG = {
8994
'rxjs/operator/filter': 'Rx.Observable.prototype',
9095
'rxjs/operator/concatMap': 'Rx.Observable.prototype',
9196

97+
'ui-router-core': 'ui-router-core',
98+
'ui-router-rx': 'ui-router-rx',
9299
'@angular/core': 'ng.core',
93100
'@angular/common': 'ng.common',
94101
}

0 commit comments

Comments
 (0)