-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): bundle using rollupjs for smaller bundle and faster init times
- Loading branch information
1 parent
a51f1de
commit a4b5500
Showing
5 changed files
with
108 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import nodeResolve from 'rollup-plugin-node-resolve'; | ||
import uglify from 'rollup-plugin-uglify'; | ||
|
||
var MINIFY = process.env.MINIFY; | ||
var ROUTER = process.env.ROUTER; | ||
var EVENTS = process.env.EVENTS; | ||
var RESOLVE = process.env.RESOLVE; | ||
|
||
var pkg = require('./package.json'); | ||
var banner = | ||
`/** | ||
* ${pkg.description} | ||
* @version v${pkg.version} | ||
* @link ${pkg.homepage} | ||
* @license MIT License, http://www.opensource.org/licenses/MIT | ||
*/`; | ||
|
||
var uglifyOpts = { output: {} }; | ||
// retain multiline comment with @license | ||
uglifyOpts.output.comments = (node, comment) => | ||
comment.type === 'comment2' && /@license/i.test(comment.value); | ||
var plugins = (MINIFY ? [uglify(uglifyOpts)] : []).concat(nodeResolve({jsnext: true})); | ||
|
||
var extension = MINIFY ? ".min.js" : ".js"; | ||
|
||
const BASE_CONFIG = { | ||
sourceMap: true, | ||
format: 'umd', | ||
exports: 'named', | ||
plugins: plugins, | ||
banner: banner, | ||
}; | ||
|
||
const ROUTER_CONFIG = Object.assign({ | ||
moduleName: 'angular-ui-router', | ||
entry: 'lib-esm/index.js', | ||
dest: 'release/angular-ui-router' + extension, | ||
globals: { angular: 'angular' }, | ||
external: 'angular', | ||
}, BASE_CONFIG); | ||
|
||
const EVENTS_CONFIG = Object.assign({}, BASE_CONFIG, { | ||
moduleName: 'angular-ui-router-state-events', | ||
entry: 'lib-esm/legacy/stateEvents.js', | ||
dest: 'release/stateEvents' + extension, | ||
globals: { angular: 'angular', 'ui-router-core': 'ui-router-core' }, | ||
external: ['angular', 'ui-router-core'], | ||
}); | ||
|
||
const RESOLVE_CONFIG = Object.assign({}, BASE_CONFIG, { | ||
moduleName: 'angular-ui-router-resolve-service', | ||
entry: 'lib-esm/legacy/resolveService.js', | ||
dest: 'release/resolveService' + extension, | ||
globals: { angular: 'angular', 'ui-router-core': 'ui-router-core' }, | ||
external: ['angular', 'ui-router-core'], | ||
}); | ||
|
||
const CONFIG = | ||
RESOLVE ? RESOLVE_CONFIG : | ||
EVENTS ? EVENTS_CONFIG : | ||
ROUTER ? ROUTER_CONFIG : ROUTER_CONFIG; | ||
|
||
export default CONFIG; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters