Closed wesselvdv closed 1 year ago
My main question is whether this works with the standard builder/the ngc
compiler binary, compared to using @angular-builders/custom-webpack:browser
. In any case, this isn't actionable for us unless we have a reproduction.
I am unable to compile without that minor adjustment in the config.resolve.extensionAlias
. I would assume that isn't that big of a deal. I can turn it into a patch I think, so I can drop the custom webpack builder stuff.
I don't know how @angular-builders/custom-webpack:browser
integrates the Angular compiler, but that does drive the compilation so it could certainly affect how this behaves.
I've added the custom config as a patch in the @angular-devkit/build-angular:browser
and @angular-devkit/build-angular:dev-server
. Doesn't seem to make it faster or slower.
diff --git a/src/webpack/configs/common.js b/src/webpack/configs/common.js
index 3a014a9d62e7df059506d06e30623d0289b2482e..0be48f0ff1dd8edbbdcc668ab0f3780fd3eeb609 100755
--- a/src/webpack/configs/common.js
+++ b/src/webpack/configs/common.js
@@ -253,6 +253,10 @@ async function getCommonConfig(wco) {
resolve: {
roots: [projectRoot],
extensions: ['.ts', '.tsx', '.mjs', '.js'],
+ extensionAlias: {
+ '.js': ['.ts', '.js'],
+ '.mjs': ['.mts', '.mjs', '.js'],
+ },
symlinks: !buildOptions.preserveSymlinks,
modules: [tsConfig.options.baseUrl || projectRoot, 'node_modules'],
mainFields: isPlatformServer
I removed the references to the custom webpack.config.cjs
, as I am no longer using that now.
Also important to note, this is causing my dx to be very bad. I have to wait 40-60 seconds after each change to see the result. What additional info do you need?
We would need a reproduction.
Makes sense, here I was hoping there’d be a smoking gun in the cpu profiles that I had missed. I’ll try and see if I can get a good repro.
I have managed to find a major culprit. I wasn't exporting my lazy loaded components. (e.g. no export class ...
), because I am defining the routes in the same file and subsequently export the routes. Explicitly exporting all those components seems to have sped it up significantly. (~60 seconds to ~15 seconds)
I still believe 15 seconds is too slow for simply adding a console.log(1);
statement in the main.ts
, but I can create a profile in the devtools now.
@wesselvdv, unfortunately without a reproduction it's hard to investigate this any further.
Thanks for reporting this issue. However, you didn't provide sufficient information for us to understand and reproduce the problem. Please check out our submission guidelines to understand why we can't act on issues that are lacking important information.
If the problem persists, please file a new issue and ensure you provide all of the required information when filling out the issue template.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Command
serve
Description
It's as if the incremental compilation isn't working properly for my setup.
I've debugged it a bit, and I can see that when following the instructions in this comment upon changing the
main.ts
withconsole.log(1)
all my lazy loaded routes are being marked asphysicallyChangedTsFiles
when putting a debug break on L189 in incremental.ts in@angular/compiler-cli
.Not sure if the above is intended, but it's something that I noticed.
Minimal Reproduction
ng serve --proxy-config proxy.config.json --host 0.0.0.0 --port 4200 --watch
Exception or Error
No response
Your Environment
Anything else relevant?
I have been unable to make a cpu profile for entire rebuild, but I've managed to split it into 3 cpu profiles that have overlap. Trying to do it in one haul causes DevTools to hang.
cpu-1 cpu-2 cpu-3
tsconfig.app.json:
../tsconfig.json:
../../tsconfig.json:
./tsconfig.base.json:
angular.json: