Angular 10将“ compiler.js”保留在AOT Webpack软件包中

问题描述

我在生产模式下的webpack中为AOT配置了Angular 10项目,但是我的软件包中仍然有大约1Mb的“ compiler.js”。我记得当我在Angular 6中配置它时,捆绑包小得多,而编译器不在其中,因为据我所知它就是JIT。

请检查包的附件图片和我的webpack配置:

{
  mode: 'production',...
  plugins: [
    ...
    new AngularCompilerPlugin({
      platform: PLATFORM.browser,mainPath: `${ SRC }/client.ts`,tsConfigPath: `${ SRC }/tsconfig.json`,skipCodeGeneration: true,compilerOptions: {
        enableIvy: false,},}),...
  ],...
  optimization: {
    minimize: true,chunkIds: 'named',minimizer: [
      new TerserPlugin({
        extractComments: true,terserOptions: { mangle: true,compress: {},],}
}

enter image description here

更新:

我创建了一个Hello World项目,看看结果将发生什么变化,它看起来像摇晃树的@angular模块,我还在打字稿配置中添加了esnext,但没有任何变化:

enter image description here

更新:

我将Angular降级到9,但仍然值得。本文中针对预告片的设置也将应用https://angular.io/guide/ivy-compatibility#payload-size-debugging

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)