Skip to content

Commit 8db3696

Browse files
feat(build): Publish non-monolithic UMD bundle ui-router-angularjs.js
This enables ui-router plugin support when using script tags Fixes #3418
1 parent f535f42 commit 8db3696

File tree

2 files changed

+23
-28
lines changed

2 files changed

+23
-28
lines changed

rollup.config.js

+23-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,26 @@ import sourcemaps from 'rollup-plugin-sourcemaps';
55
import visualizer from 'rollup-plugin-visualizer';
66

77
var MINIFY = process.env.MINIFY;
8+
var MONOLITHIC = process.env.MONOLITHIC;
89
var ROUTER = process.env.ROUTER;
910
var EVENTS = process.env.EVENTS;
1011
var RESOLVE = process.env.RESOLVE;
1112

1213
var pkg = require('./package.json');
1314
var banner =
1415
`/**
15-
* ${pkg.description}
16+
* ${pkg.description}`;
17+
if (ROUTER && MONOLITHIC) {
18+
banner += `
19+
* NOTICE: This monolithic bundle also bundles the @uirouter/core code.
20+
* This causes it to be incompatible with plugins that depend on @uirouter/core.
21+
* We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead.
22+
* For more information, see http://ui-router.github.io/blog/angular-ui-router-umd-bundles`
23+
} else if (ROUTER) {
24+
banner += `
25+
* This bundle requires the ui-router-core.js bundle from the @uirouter/core package.`
26+
}
27+
banner += `
1628
* @version v${pkg.version}
1729
* @link ${pkg.homepage}
1830
* @license MIT License, http://www.opensource.org/licenses/MIT
@@ -43,6 +55,15 @@ const BASE_CONFIG = {
4355
};
4456

4557
const ROUTER_CONFIG = Object.assign({
58+
moduleName: '@uirouter/angularjs',
59+
entry: 'lib-esm/index.js',
60+
dest: 'release/ui-router-angularjs' + extension,
61+
globals: { angular: 'angular', '@uirouter/core': '@uirouter/core' },
62+
external: ['angular', '@uirouter/core'],
63+
}, BASE_CONFIG);
64+
65+
// Also bundles the code from @uirouter/core into the same bundle
66+
const MONOLITHIC_ROUTER_CONFIG = Object.assign({
4667
moduleName: '@uirouter/angularjs',
4768
entry: 'lib-esm/index.js',
4869
dest: 'release/angular-ui-router' + extension,
@@ -69,6 +90,7 @@ const RESOLVE_CONFIG = Object.assign({}, BASE_CONFIG, {
6990
const CONFIG =
7091
RESOLVE ? RESOLVE_CONFIG :
7192
EVENTS ? EVENTS_CONFIG :
93+
MONOLITHIC ? MONOLITHIC_ROUTER_CONFIG :
7294
ROUTER ? ROUTER_CONFIG : ROUTER_CONFIG;
7395

7496
export default CONFIG;

webpack.core-adapter.js

-27
This file was deleted.

0 commit comments

Comments
 (0)