@@ -67,42 +67,43 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
6767 entryPoints [ 'main' ] = [ path . resolve ( root , buildOptions . main ) ] ;
6868 }
6969
70- const es5Polyfills = path . join ( __dirname , '..' , 'es5-polyfills.js' ) ;
71- const es5JitPolyfills = path . join ( __dirname , '..' , 'es5-jit-polyfills.js' ) ;
72-
73- if ( targetInFileName ) {
74- // For differential loading we don't need to have 2 polyfill bundles
75- if ( buildOptions . scriptTargetOverride === ScriptTarget . ES2015 ) {
76- entryPoints [ 'polyfills' ] = [ path . join ( __dirname , '..' , 'safari-nomodule.js' ) ] ;
77- } else {
78- entryPoints [ 'polyfills' ] = [ es5Polyfills ] ;
79- if ( ! buildOptions . aot ) {
80- entryPoints [ 'polyfills' ] . push ( es5JitPolyfills ) ;
70+ if ( wco . buildOptions . platform !== 'server' ) {
71+ const es5Polyfills = path . join ( __dirname , '..' , 'es5-polyfills.js' ) ;
72+ const es5JitPolyfills = path . join ( __dirname , '..' , 'es5-jit-polyfills.js' ) ;
73+ if ( targetInFileName ) {
74+ // For differential loading we don't need to have 2 polyfill bundles
75+ if ( buildOptions . scriptTargetOverride === ScriptTarget . ES2015 ) {
76+ entryPoints [ 'polyfills' ] = [ path . join ( __dirname , '..' , 'safari-nomodule.js' ) ] ;
77+ } else {
78+ entryPoints [ 'polyfills' ] = [ es5Polyfills ] ;
79+ if ( ! buildOptions . aot ) {
80+ entryPoints [ 'polyfills' ] . push ( es5JitPolyfills ) ;
81+ }
8182 }
82- }
83- } else {
84- // For NON differential loading we want to have 2 polyfill bundles
85- if ( buildOptions . es5BrowserSupport
86- || ( buildOptions . es5BrowserSupport === undefined && isEs5SupportNeeded ( projectRoot ) ) ) {
87- entryPoints [ 'polyfills-es5' ] = [ es5Polyfills ] ;
88- if ( ! buildOptions . aot ) {
89- entryPoints [ 'polyfills-es5' ] . push ( es5JitPolyfills ) ;
83+ } else {
84+ // For NON differential loading we want to have 2 polyfill bundles
85+ if ( buildOptions . es5BrowserSupport
86+ || ( buildOptions . es5BrowserSupport === undefined && isEs5SupportNeeded ( projectRoot ) ) ) {
87+ entryPoints [ 'polyfills-es5' ] = [ es5Polyfills ] ;
88+ if ( ! buildOptions . aot ) {
89+ entryPoints [ 'polyfills-es5' ] . push ( es5JitPolyfills ) ;
90+ }
9091 }
9192 }
92- }
9393
94- if ( buildOptions . polyfills ) {
95- entryPoints [ 'polyfills' ] = [
96- ...( entryPoints [ 'polyfills' ] || [ ] ) ,
97- path . resolve ( root , buildOptions . polyfills ) ,
98- ] ;
99- }
94+ if ( buildOptions . polyfills ) {
95+ entryPoints [ 'polyfills' ] = [
96+ ...( entryPoints [ 'polyfills' ] || [ ] ) ,
97+ path . resolve ( root , buildOptions . polyfills ) ,
98+ ] ;
99+ }
100100
101- if ( ! buildOptions . aot ) {
102- entryPoints [ 'polyfills' ] = [
103- ...( entryPoints [ 'polyfills' ] || [ ] ) ,
104- path . join ( __dirname , '..' , 'jit-polyfills.js' ) ,
105- ] ;
101+ if ( ! buildOptions . aot ) {
102+ entryPoints [ 'polyfills' ] = [
103+ ...( entryPoints [ 'polyfills' ] || [ ] ) ,
104+ path . join ( __dirname , '..' , 'jit-polyfills.js' ) ,
105+ ] ;
106+ }
106107 }
107108
108109 if ( buildOptions . profile || process . env [ 'NG_BUILD_PROFILING' ] ) {
0 commit comments