@@ -2,7 +2,7 @@ import { normalizeExtraEntryPoints } from '@angular-devkit/build-angular/src/ang
22import { AssetPatternClass } from '@angular-devkit/build-angular/src/browser/schema' ;
33import { getSystemPath , join , normalize } from '@angular-devkit/core' ;
44import { writeFileSync } from 'fs' ;
5- import { resolve } from 'path' ;
5+ import { posix , resolve } from 'path' ;
66
77import { CordovaBuildBuilderSchema } from '../cordova-build/schema' ;
88import { CordovaServeBuilderSchema } from '../cordova-serve/schema' ;
@@ -66,9 +66,7 @@ export function prepareBrowserConfig(
6666 ) ;
6767 writeFileSync (
6868 configPath ,
69- `window.Ionic = window.Ionic || {}; Ionic.ConsoleLogServerConfig = { wsPort: ${
70- options . consolelogsPort
71- } }`
69+ `window.Ionic = window.Ionic || {}; Ionic.ConsoleLogServerConfig = { wsPort: ${ options . consolelogsPort } }`
7270 ) ;
7371 optionsStarter . scripts . push ( {
7472 input : configPath ,
@@ -155,9 +153,7 @@ export function prepareServerConfig(
155153 ) ;
156154 writeFileSync (
157155 configPath ,
158- `window.Ionic = window.Ionic || {}; Ionic.ConsoleLogServerConfig = { wsPort: ${
159- options . consolelogsPort
160- } }`
156+ `window.Ionic = window.Ionic || {}; Ionic.ConsoleLogServerConfig = { wsPort: ${ options . consolelogsPort } }`
161157 ) ;
162158 scripts . push ( { input : configPath , bundleName : 'consolelogs' , lazy : false } ) ;
163159 scripts . push ( {
@@ -220,20 +216,29 @@ export function prepareServerConfig(
220216
221217 const copyWebpackPluginPatterns = assets . map ( ( asset : AssetPatternClass ) => {
222218 // Resolve input paths relative to workspace root and add slash at the end.
223- asset . input = resolve ( root , asset . input ) . replace ( / \\ / g , '/' ) ;
224- asset . input = asset . input . endsWith ( '/' ) ? asset . input : asset . input + '/' ;
225- asset . output = asset . output . endsWith ( '/' )
226- ? asset . output
227- : asset . output + '/' ;
219+ // tslint:disable-next-line: prefer-const
220+ let { input, output , ignore = [ ] , glob } = asset ;
221+ input = resolve ( root , input ) . replace ( / \\ / g , '/' ) ;
222+ input = input . endsWith ( '/' ) ? input : input + '/' ;
223+ output = output . endsWith ( '/' ) ? output : output + '/' ;
228224
229225 return {
230- context : asset . input ,
226+ context : input ,
231227 // Now we remove starting slash to make Webpack place it from the output root.
232- to : asset . output . replace ( / ^ \/ / , '' ) ,
233- ignore : asset . ignore ,
234- from : {
235- glob : asset . glob ,
228+ to : output . replace ( / ^ \/ / , '' ) ,
229+ from : glob ,
230+ noErrorOnMissing : true ,
231+ globOptions : {
236232 dot : true ,
233+ ignore : [
234+ '.gitkeep' ,
235+ '**/.DS_Store' ,
236+ '**/Thumbs.db' ,
237+ // Negate patterns needs to be absolute because copy-webpack-plugin uses absolute globs which
238+ // causes negate patterns not to match.
239+ // See: https://github.com/webpack-contrib/copy-webpack-plugin/issues/498#issuecomment-639327909
240+ ...ignore ,
241+ ] . map ( i => posix . join ( input , i ) ) ,
237242 } ,
238243 } ;
239244 } ) ;
0 commit comments