Skip to content

Commit 2b5f23d

Browse files
committed
Step 3 - Fix: Manually define paths for @angular/ssr/node to resolve external dependency issue in server.mjs.
1 parent 9b670a8 commit 2b5f23d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

libs/nx-angular-mf/src/builders/es-plugin/entry-point-for-extend-dependencies.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ export function entryPointForExtendDependencies(config: ConfigMf): Plugin {
2121
delete build.initialOptions.define.ngServerMode;
2222
build.initialOptions.splitting = false;
2323

24+
if (build.initialOptions.entryPoints['server']) {
25+
build.onResolve({ filter: /./ }, (data) => {
26+
const { path } = data;
27+
if (path === '@angular/ssr/node') {
28+
return {
29+
path: require.resolve('@angular/ssr/node', {
30+
paths: [process.cwd()],
31+
}),
32+
};
33+
}
34+
return null;
35+
});
36+
}
37+
2438
if (build.initialOptions.platform !== 'browser') return;
2539

2640
build.onEnd((resultBuild) => {

0 commit comments

Comments
 (0)