Skip to content

Commit

Permalink
fix(bundle): Only bundle ui-router-ng2 code (do not bundle ui-router-…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
christopherthielen committed Mar 5, 2017
1 parent 89884b9 commit a285218
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ui-router-ng2",
"description": "State-based routing for Angular 2",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"scripts": {
"clean": "shx rm -rf lib lib-esm _bundles _dec",
"compile": "npm run clean && ngc",
Expand Down Expand Up @@ -39,7 +39,7 @@
"module": "lib/index.js",
"typings": "lib/index.d.ts",
"dependencies": {
"ui-router-core": "=4.0.0",
"ui-router-core": "=5.0.0",
"ui-router-rx": "=0.2.1"
},
"peerDependencies": {
Expand Down
11 changes: 9 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ uglifyOpts.output.comments = (node, comment) =>
comment.type === 'comment2' && /@license/i.test(comment.value);

let plugins = [
nodeResolve({jsnext: true}),
nodeResolve({ jsnext: true }),
progress(),
sourcemaps(),
commonjs(),
Expand All @@ -41,9 +41,14 @@ function onwarn(warning) {
}

function isExternal(id) {
// ui-router-core and ui-router-rx should be external
// All rxjs and @angular/* should be external
// except for @angular/router/src/router_config_loader
let externals = [ /^rxjs/, /^@angular\/(?!router\/src\/router_config_loader)/, ];
let externals = [
/^ui-router-(core|rx)/,
/^rxjs/,
/^@angular\/(?!router\/src\/router_config_loader)/,
];
return externals.map(regex => regex.exec(id)).reduce((acc, val) => acc || !!val, false);
}

Expand Down Expand Up @@ -89,6 +94,8 @@ const CONFIG = {
'rxjs/operator/filter': 'Rx.Observable.prototype',
'rxjs/operator/concatMap': 'Rx.Observable.prototype',

'ui-router-core': 'ui-router-core',
'ui-router-rx': 'ui-router-rx',
'@angular/core': 'ng.core',
'@angular/common': 'ng.common',
}
Expand Down

0 comments on commit a285218

Please sign in to comment.