Skip to content

Commit a6c06c4

Browse files
committed
fix(@angular-devkit/build-angular): allow linker JIT support with prebundling with esbuild builder
When using prebundling with the Vite-based development server, the Angular linker will now correctly emit JIT module scope information. This information is required in JIT mode for NgModules to successfully be used in an application.
1 parent b184f2d commit a6c06c4

File tree

1 file changed

+4
-1
lines changed
  • packages/angular_devkit/build_angular/src/builders/dev-server

1 file changed

+4
-1
lines changed

packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,10 @@ export async function setupServer(
376376
name: 'angular-vite-optimize-deps',
377377
setup(build) {
378378
const transformer = new JavaScriptTransformer(
379-
{ sourcemap: !!build.initialOptions.sourcemap },
379+
// Always enable JIT linking to support applications built with and without AOT.
380+
// In a development environment the additional scope information does not
381+
// have a negative effect unlike production where final output size is relevant.
382+
{ sourcemap: !!build.initialOptions.sourcemap, jit: true },
380383
1,
381384
);
382385

0 commit comments

Comments
 (0)