@@ -2,7 +2,6 @@ import path from "path";
2
2
import url from "url" ;
3
3
import Module from "module" ;
4
4
5
- import { klona } from "klona/full" ;
6
5
import { cosmiconfig , defaultLoaders } from "cosmiconfig" ;
7
6
8
7
const parentModule = module ;
@@ -185,11 +184,9 @@ async function loadConfig(loaderContext, config, postcssOptions) {
185
184
options : postcssOptions || { } ,
186
185
} ;
187
186
188
- result . config = result . config ( api ) ;
187
+ return { ... result , config : result . config ( api ) } ;
189
188
}
190
189
191
- result = klona ( result ) ;
192
-
193
190
return result ;
194
191
}
195
192
@@ -330,7 +327,7 @@ async function getPostcssOptions(
330
327
loaderContext . emitError ( error ) ;
331
328
}
332
329
333
- const processOptionsFromConfig = loadedConfig . config || { } ;
330
+ const processOptionsFromConfig = { ... loadedConfig . config } || { } ;
334
331
335
332
if ( processOptionsFromConfig . from ) {
336
333
processOptionsFromConfig . from = path . resolve (
@@ -346,10 +343,7 @@ async function getPostcssOptions(
346
343
) ;
347
344
}
348
345
349
- // No need them for processOptions
350
- delete processOptionsFromConfig . plugins ;
351
-
352
- const processOptionsFromOptions = klona ( normalizedPostcssOptions ) ;
346
+ const processOptionsFromOptions = { ...normalizedPostcssOptions } ;
353
347
354
348
if ( processOptionsFromOptions . from ) {
355
349
processOptionsFromOptions . from = path . resolve (
@@ -365,16 +359,20 @@ async function getPostcssOptions(
365
359
) ;
366
360
}
367
361
368
- // No need them for processOptions
369
- delete processOptionsFromOptions . config ;
370
- delete processOptionsFromOptions . plugins ;
362
+ // No need `plugins` and `config` for processOptions
363
+ const { plugins : __plugins , ...optionsFromConfig } = processOptionsFromConfig ;
364
+ const {
365
+ config : _config ,
366
+ plugins : _plugins ,
367
+ ...optionsFromOptions
368
+ } = processOptionsFromOptions ;
371
369
372
370
const processOptions = {
373
371
from : file ,
374
372
to : file ,
375
373
map : false ,
376
- ...processOptionsFromConfig ,
377
- ...processOptionsFromOptions ,
374
+ ...optionsFromConfig ,
375
+ ...optionsFromOptions ,
378
376
} ;
379
377
380
378
if ( typeof processOptions . parser === "string" ) {
0 commit comments