File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
packages/angular_devkit/build_angular/src/browser Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -471,7 +471,27 @@ export function buildWebpackBrowser(
471471 }
472472 }
473473
474+ // Workaround Node.js issue prior to 10.16 with copyFile on macOS
475+ // https://github.com/angular/angular-cli/issues/15544 & https://github.com/nodejs/node/pull/27241
476+ let copyFileWorkaround = false ;
477+ if ( process . platform === 'darwin' ) {
478+ const version = process . versions . node . split ( '.' ) . map ( part => Number ( part ) ) ;
479+ if (
480+ version [ 0 ] < 10 ||
481+ version [ 0 ] === 11 ||
482+ ( version [ 0 ] === 10 && version [ 1 ] < 16 )
483+ ) {
484+ copyFileWorkaround = true ;
485+ }
486+ }
487+
474488 for ( const action of cacheActions ) {
489+ if ( copyFileWorkaround ) {
490+ try {
491+ fs . unlinkSync ( action . dest ) ;
492+ } catch { }
493+ }
494+
475495 fs . copyFileSync ( action . src , action . dest , fs . constants . COPYFILE_FICLONE ) ;
476496 if ( process . platform !== 'win32' ) {
477497 // The cache writes entries as readonly and when using copyFile the permissions will also be copied.
You can’t perform that action at this time.
0 commit comments