@@ -155,7 +155,15 @@ class JsonWebpackSerializer {
155
155
}
156
156
157
157
private _concatPlugin ( plugin : any ) {
158
- return plugin . settings ;
158
+ const options = plugin . settings ;
159
+ if ( ! options || ! options . filesToConcat ) {
160
+ return options ;
161
+ }
162
+
163
+ const filesToConcat = options . filesToConcat
164
+ . map ( ( file : string ) => path . relative ( process . cwd ( ) , file ) ) ;
165
+
166
+ return { ...options , filesToConcat } ;
159
167
}
160
168
161
169
private _pluginsReplacer ( plugins : any [ ] ) {
@@ -235,7 +243,14 @@ class JsonWebpackSerializer {
235
243
} else if ( plugin [ 'copyWebpackPluginPatterns' ] ) {
236
244
// CopyWebpackPlugin doesn't have a constructor nor save args.
237
245
this . variableImports [ 'copy-webpack-plugin' ] = 'CopyWebpackPlugin' ;
238
- const patternsSerialized = serializer ( plugin [ 'copyWebpackPluginPatterns' ] ) ;
246
+ const patternOptions = plugin [ 'copyWebpackPluginPatterns' ] . map ( ( pattern : any ) => {
247
+ if ( ! pattern . context ) {
248
+ return pattern ;
249
+ }
250
+ const context = path . relative ( process . cwd ( ) , pattern . context ) ;
251
+ return { ...pattern , context } ;
252
+ } ) ;
253
+ const patternsSerialized = serializer ( patternOptions ) ;
239
254
const optionsSerialized = serializer ( plugin [ 'copyWebpackPluginOptions' ] ) || 'undefined' ;
240
255
return `\uFF02CopyWebpackPlugin(${ patternsSerialized } , ${ optionsSerialized } )\uFF02` ;
241
256
}
0 commit comments