Skip to content

Commit 1ea4a5f

Browse files
alan-agius4mgechev
authored andcommitted
feat(@angular-devkit/build-angular): ignore express and hapi depedency expresstion (#15586)
In version 9 universal express and hapi `server.ts` will be bundled using the CLI server builder. We need to add this to avoid `the request of a dependency is an expression` warnings See: angular/universal#1237
1 parent 35a0145 commit 1ea4a5f

File tree

1 file changed

+7
-2
lines changed
  • packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs

1 file changed

+7
-2
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/server.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import { isAbsolute } from 'path';
9-
import { Configuration } from 'webpack';
9+
import { Configuration, ContextReplacementPlugin } from 'webpack';
1010
import { WebpackConfigOptions } from '../build-options';
1111
import { getSourceMapDevTool } from './utils';
1212

@@ -30,7 +30,12 @@ export function getServerConfig(wco: WebpackConfigOptions): Configuration {
3030
output: {
3131
libraryTarget: 'commonjs',
3232
},
33-
plugins: extraPlugins,
33+
plugins: [
34+
// Fixes Critical dependency: the request of a dependency is an expression
35+
new ContextReplacementPlugin(/@?hapi(\\|\/)/),
36+
new ContextReplacementPlugin(/express(\\|\/)/),
37+
...extraPlugins,
38+
],
3439
node: false,
3540
};
3641

0 commit comments

Comments
 (0)