@@ -2,7 +2,7 @@ import { normalizeExtraEntryPoints } from '@angular-devkit/build-angular/src/ang
2
2
import { AssetPatternClass } from '@angular-devkit/build-angular/src/browser/schema' ;
3
3
import { getSystemPath , join , normalize } from '@angular-devkit/core' ;
4
4
import { writeFileSync } from 'fs' ;
5
- import { resolve } from 'path' ;
5
+ import { posix , resolve } from 'path' ;
6
6
7
7
import { CordovaBuildBuilderSchema } from '../cordova-build/schema' ;
8
8
import { CordovaServeBuilderSchema } from '../cordova-serve/schema' ;
@@ -66,9 +66,7 @@ export function prepareBrowserConfig(
66
66
) ;
67
67
writeFileSync (
68
68
configPath ,
69
- `window.Ionic = window.Ionic || {}; Ionic.ConsoleLogServerConfig = { wsPort: ${
70
- options . consolelogsPort
71
- } }`
69
+ `window.Ionic = window.Ionic || {}; Ionic.ConsoleLogServerConfig = { wsPort: ${ options . consolelogsPort } }`
72
70
) ;
73
71
optionsStarter . scripts . push ( {
74
72
input : configPath ,
@@ -155,9 +153,7 @@ export function prepareServerConfig(
155
153
) ;
156
154
writeFileSync (
157
155
configPath ,
158
- `window.Ionic = window.Ionic || {}; Ionic.ConsoleLogServerConfig = { wsPort: ${
159
- options . consolelogsPort
160
- } }`
156
+ `window.Ionic = window.Ionic || {}; Ionic.ConsoleLogServerConfig = { wsPort: ${ options . consolelogsPort } }`
161
157
) ;
162
158
scripts . push ( { input : configPath , bundleName : 'consolelogs' , lazy : false } ) ;
163
159
scripts . push ( {
@@ -220,20 +216,29 @@ export function prepareServerConfig(
220
216
221
217
const copyWebpackPluginPatterns = assets . map ( ( asset : AssetPatternClass ) => {
222
218
// 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 + '/' ;
228
224
229
225
return {
230
- context : asset . input ,
226
+ context : input ,
231
227
// 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 : {
236
232
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 ) ) ,
237
242
} ,
238
243
} ;
239
244
} ) ;
0 commit comments