简体   繁体   English

单个webpack配置中的多角度应用程序

[英]multiple angular application in single webpack config

i have project with many standelone angular application on it. 我有很多standelone角度应用项目。 Typical user case can be : 典型的用户案例可以是:

  • admin.ts admin.ts
  • front.ts front.ts
  • dashboard.ts dashboard.ts

Where each are angular app. 每个都是有角度的app。 To manage that, i have actually single webpack.config.js where i do all packaging stuff. 为了管理它,我实际上单个webpack.config.js ,我做所有包装的东西。

The issue come when i want to add AoT compilation. 当我想添加AoT编译时会出现问题。 For that i use @ngtools/webpack where unfortunatly we have to hardcoded on our webpack configuration the entrypoint path like this : 为此我使用@ ngtools / webpack ,不幸的是我们必须在我们的webpack配置上硬编码这样的入口点路径:

  plugins: [
    new AngularCompilerPlugin({
      tsConfigPath: 'path/to/tsconfig.json',
      entryModule: 'path/to/app.module#AppModule',
      sourceMap: true
    })
  ]

as you can see here on the angular-cli issue tracker, they not have any plan to handle multiple entry modules. 正如您在angular-cli问题跟踪器上看到的那样,他们没有任何计划来处理多个入口模块。

Have you any magic trick to play around this limitation and still keep single compilation process ? 你有任何魔术可以解决这个限制并仍然保持单个编译过程吗?

proof of concept is available on my github 我的github上提供了概念验证

I'd suggest checking out @angular-builders/custom-webpack 我建议查看@ angular-builders / custom-webpack

It extends @angular-devkit/build-angular but allows you to modify the webpack config. 它扩展了@ angular-devkit / build-angular,但允许您修改webpack配置。 Allowing you to add other entry points, etc. It has fairly good documentation on how set it up. 允许您添加其他入口点等。它有关于如何设置的相当好的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM