加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rollup.config.js 2.18 KB
一键复制 编辑 原始数据 按行查看 历史
import resolve from 'rollup-plugin-node-resolve'
import replace from 'rollup-plugin-replace'
const format = process.env.ROLLUP_FORMAT || 'es'
let globals = {
'@angular/animations': 'ng.animations',
'@angular/cdk': 'ng.cdk',
'@angular/core': 'ng.core',
'@angular/common': 'ng.common',
'@angular/compiler': 'ng.compiler',
'@angular/forms': 'ng.forms',
'@angular/platform-browser': 'ng.platformBrowser',
'moment': 'moment',
'moment/locale/zh-cn': null,
'rxjs/BehaviorSubject': 'Rx',
'rxjs/Observable': 'Rx',
'rxjs/Subject': 'Rx',
'rxjs/Subscription': 'Rx',
'rxjs/observable/fromPromise': 'Rx.Observable',
'rxjs/observable/forkJoin': 'Rx.Observable',
'rxjs/observable/fromEvent': 'Rx.Observable',
'rxjs/observable/merge': 'Rx.Observable',
'rxjs/observable/of': 'Rx.Observable',
'rxjs/operator/auditTime': 'Rx.Observable.prototype',
'rxjs/operator/catch': 'Rx.Observable.prototype',
'rxjs/operator/debounceTime': 'Rx.Observable.prototype',
'rxjs/operator/distinctUntilChanged': 'Rx.Observable.prototype',
'rxjs/operator/do': 'Rx.Observable.prototype',
'rxjs/operator/filter': 'Rx.Observable.prototype',
'rxjs/operator/finally': 'Rx.Observable.prototype',
'rxjs/operator/first': 'Rx.Observable.prototype',
'rxjs/operator/map': 'Rx.Observable.prototype',
'rxjs/operator/pluck': 'Rx.Observable.prototype',
'rxjs/operator/startWith': 'Rx.Observable.prototype',
'rxjs/operator/switchMap': 'Rx.Observable.prototype',
'rxjs/operator/takeUntil': 'Rx.Observable.prototype',
'rxjs/operator/throttleTime': 'Rx.Observable.prototype',
}
if (format === 'es') {
globals = Object.assign(globals, {
'tslib': 'tslib',
})
}
let input
let file
switch (format) {
case 'es':
input = './publish/src/index.js'
file = './publish/esm15/index.js'
break
case 'umd':
input = './publish/esm5/index.js'
file = './publish/bundles/ng-zorro-antd.umd.js'
break
default:
throw new Error(`format ${format} is not supported`)
}
export default {
input,
output: {
file,
format,
},
exports: 'named',
name: 'ngZorro.antd',
plugins: [replace({ "import * as moment": "import moment" }), resolve()],
external: Object.keys(globals),
globals,
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化