迁移角4 +角种子到角6 +角cli
我正在使用SystemJS在我的一个组件中使用动态加载插件
SystemJS.import("client/plugins/" + this.pluginElement.type + "/" + this.pluginElement.type + ".js")
如果我实际运行应用程序,我有:
http://localhost/client/plugins/dapChart/dapChart.js 404 (Not Found)
实际上,js文件不作为资产出现。
在src / client / plugins文件夹中,我有一组用Typescript编写的模块,我可以在我的应用程序中自由使用。
我想找到一种方法告诉角度CLI编译我的插件文件夹并将结果视为资产并将其复制,就像它在我的dist文件夹中一样。
在我看来,我看到3个选项(没有任何证据,如果这些是好的):
tsc -p src/client/plugins --outDir src/client/assets/plugins
但是停止服务,编译然后启动服务是非常烦人的如何使用Angular 6 / Angular cli将我的已编译插件放入我的构建输出目录中
我实际上忘记了自己是如何做到的,但你可以添加cli配置文件。
在angular-cli中,您可以执行以下操作:
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"client": [ "plugins": [ ] ], //something like this
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
}