1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

angular - main.js ends up in Lazy Chunk files

Discussão em 'Angular' iniciado por Alexus, Novembro 4, 2024 às 18:22.

  1. Alexus

    Alexus Guest

    I have two projects with very similar setup. Both following the NX monorepo structure and setup, I've done couple of migrations from older version to a newer one, and I noticed that in one of the apps, the main.js is always shown in the Lazy Chunk Files category in the build log:

    Initial chunk files | Names | Raw size | Estimated transfer size
    polyfills.45732861e6a6851d.js | polyfills | 34.19 kB | 11.03 kB

    | Initial total | 34.19 kB | 11.03 kB

    Lazy chunk files | Names | Raw size | Estimated transfer size
    main.css, main.js | main | 277.90 kB | 49.44 kB
    runtime.a9fc7548b14f6ea7.js | runtime | 1.06 kB | 587 bytes


    where the other App is showing correctly:

    Initial chunk files | Names | Raw size | Estimated transfer size
    main.2b3b603cebbde51f.js | main | 1.30 MB | 276.63 kB
    polyfills.fefcd4772972c304.js | polyfills | 34.19 kB | 11.04 kB


    it even has the hash at the end of file name. Where the first one is missing, which is typical for lazy-loaded chunks. But why would main.js be marked as lazy loaded chunk? Any ideas?

    I've compared all the configs, removed any references to lazy-loaded modules, but still no success whatsoever. I'm just hoping that someone might have experienced similar behavior and point me to right direction.

    Angular version 18.x Nx version 19.x

    main.ts

    if (environment.production) {
    enableProdMode();
    }

    platformBrowserDynamic().bootstrapModule(AppModule)
    .catch(err => console.error(err));


    project.json build config "

    optimization": {
    "scripts": true,
    "styles": {
    "minify": true,
    "inlineCritical": false
    },
    "fonts": true
    },
    "outputHashing": "all",
    "sourceMap": false,
    "progress": false,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": true,
    "fileReplacements": [
    {
    "replace": "apps/rspl-ui/src/environments/environment.ts",
    "with": "apps/rspl-ui/src/environments/environment.prod.ts"
    }
    ]

    Continue reading...

Compartilhe esta Página