我一直在使用rollup-angular-inline和ngc compiler inline之类的工具,但它们都没有内联我的html组件。有什么我想念的吗? ngc编译器可能是因为我使用的是angular 5,但是我不知道为什么汇总插件不起作用。我正在使用npm run build
(您可以在package.json脚本中看到它的效果),两种方法都没有内联文件。
rollup.config.js
import angularInline from 'rollup-plugin-angular-inline';
export default {
input: 'dist/index.js',
output: {
name: 'ng.patternlibrarycomponentsmodule',
format: 'umd',
file: 'dist/bundles/patternlibrarycomponentsmodule.umd.js',
globals: {
'@angular/core': 'ng.core',
'@angular/forms': 'ng.forms',
'@angular/router': 'ng.router',
'@angular/platform-browser': 'ng.platform-browser',
'rxjs/Observable': 'Rx',
'rxjs/ReplaySubject': 'Rx',
'rxjs/add/operator/map': 'Rx.Observable.prototype',
'rxjs/add/operator/mergeMap': 'Rx.Observable.prototype',
'rxjs/add/observable/fromEvent': 'Rx.Observable',
'rxjs/add/observable/of': 'Rx.Observable'
}
},
plugins: [
angularInline({ include: './src/**/*.component.js' })
]
}
package.json
{
"name": "patternlib",
"version": "0.0.2",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"transpile": "ngc --aot",
"package": "rollup -c rollup.config.js",
"minify": "uglifyjs dist/bundles/patternlibrarycomponentsmodule.umd.js --screw-ie8 --compress --mangle --comments --output dist/bundles/patternlibrarycomponentsmodule.umd.min.js",
"build": "npm run transpile && npm run package && npm run minify",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"peerDependencies": {
"@angular/animations": "^5.2.11",
"@angular/cdk": "^5.2.5",
"@angular/common": "^5.2.11",
"@angular/core": "^5.2.11",
"@angular/forms": "^5.2.11",
"@angular/router": "^5.2.11",
...
},
"devDependencies": {
"@angular/animations": "^5.2.11",
"@angular/cdk": "^5.2.5",
"@angular/cli": "^1.7.3",
"@angular/common": "^5.2.11",
"@angular/compiler": "^5.2.11",
"@angular/compiler-cli": "^5.2.11",
"@angular/core": "^5.2.11",
"@angular/forms": "^5.2.11",
"@angular/language-service": "^5.2.11",
"@angular/platform-browser": "^5.2.9",
"@angular/platform-browser-dynamic": "^5.2.9",
"@angular/router": "^5.2.11",
...
"rollup": "^0.62.0",
"rollup-plugin-angular-inline": "^1.0.1",
"rxjs": "^5.5.11",
"ts-node": "^4.0.2",
"tslint": "^5.9.1",
"typescript": "~2.4.2",
"uglify-js": "^3.4.4",
"zone.js": "^0.8.19"
}