I've created a ticket in Github for this (https://github.com/angular/angular-cli/issues/26332), but maybe someone in here can tell me what I'm doing wrong.
I've been trying to migrate to esbuild for a while now, but I keep getting stuck on this issue: everything builds fine, but any require statement in my code (for example for lazy loaded routes) results in the following error: Dynamic require of "./category-page.module-7XEIW7T3.js" is not supported
For this particular error, the piece of code in my source that causes the issue is:
{
path: 'category',
loadChildren: () => import('./category/category-page/category-page.module').then(m => m.CategoryPageModule),
},
And it happens when I try to navigate to the /category route.
In my tsconfig, I have the following settings (among other):
"target": "ES2022",
"module": "esnext",
"moduleResolution": "node",
and I don't really know what else to look at.
There's clearly some setting wrong, because I'm unable to reproduce this in any other scenario.