Skip to content

Commit 4d970eb

Browse files
committedJun 5, 2017
Add blog post about modular vs monolithic AngularJS UMD bundles
1 parent 5d3a68d commit 4d970eb

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed
 

‎_posts/2017-05-29-uirouter-for-angularjs-umd-bundles.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,43 @@ This core library has been used to create new routers for
2121

2222
### Plugins and UMD bundles
2323

24-
When UI-Router for AngularJS 1.0 was released, we split the bundles into `ui-router-core.js` and `ui-router-angularjs.js`.
25-
This was necessary to support plugins which depend only on the framework-agnostic `ui-router-core.js`.
24+
Previously, UI-Router was a single bundle: `angular-ui-router.js`.
25+
26+
During the UI-Router for AngularJS 1.0 release, we split the code into two bundles:
27+
28+
- `ui-router-core.js`: the core of UI-Router (State machine, etc)
29+
- `ui-router-angularjs.js`: the AngularJS bits (`$location`, `ui-sref` directives, etc)
30+
31+
*Users who formerly included only `angular-ui-router.js` should now include both bundles.*
32+
33+
This change was necessary to properly support dependencies to `@uirouter/core`.
34+
This enables (for example) router plugins which work with the framework-agnostic `ui-router-core.js`.
35+
2636
Note: we also [renamed our NPM packages to scoped package names](/blog/uirouter-scoped-packages/).
37+
{: .notice--info }
38+
39+
### Migration
40+
41+
If you _formerly_ used `angular-ui-router.js`, e.g.:
42+
```js
43+
<script src="node_modules/angular-ui-router/release/angular-ui-router.js"></script>
44+
```js
45+
46+
Instead, *use both new bundles from the scoped packages*.
47+
Include `ui-router-core` before including `ui-router-angularjs`:
48+
```js
49+
<script src="node_modules/@uirouter/core/_bundles/ui-router-core.js"></script>
50+
<script src="node_modules/@uirouter/angularjs/release/ui-router-angularjs.js"></script>
51+
```js
2752
28-
Users who formerly included only `angular-ui-router.js` should now include both bundles.
29-
Add [`ui-router-core.js`](https://unpkg.com/@uirouter/core/_bundles/) from the [`@uirouter/core` package](https://github.com/ui-router/core)
30-
as well as [`ui-router-angularjs.js`](https://unpkg.com/@uirouter/angularjs@1.0.3/release/) from the [`@uirouter/angularjs` package](https://github.com/angular-ui/ui-router).
53+
{: .notice--info }
54+
Ensure the version of `@uirouter/core` matches [the dependency](https://unpkg.com/@uirouter/angularjs/package.json) in `@uirouter/angularjs`.
3155
3256
### Backward compatible mono-bundle
3357
3458
For backwards compatibility, we will continue to publish a monolithic bundle as [`angular-ui-router.js`](https://unpkg.com/@uirouter/angularjs/release/).
3559
This bundle includes *both the core and angularjs code*.
36-
Existing users who rely on the `angular-ui-router.js` bundle do not have to change anything.
60+
Existing users who rely on the `angular-ui-router.js` bundle _do not have to change anything_.
3761
However, this bundle is not compatible with UI-Router plugins which depend on `@uirouter/core`.
3862
3963
### Webpack users

0 commit comments

Comments
 (0)
Please sign in to comment.