@@ -220,7 +220,9 @@ class ScriptTransformer {
220
220
const cacheFilenamePrefix = path
221
221
. basename ( filename , path . extname ( filename ) )
222
222
. replace ( / \W / g, '' ) ;
223
- return slash ( path . join ( cacheDir , `${ cacheFilenamePrefix } _${ cacheKey } ` ) ) ;
223
+ return slash (
224
+ path . join ( cacheDir , `${ cacheFilenamePrefix } _${ cacheKey } ` ) ,
225
+ ) ;
224
226
}
225
227
226
228
private _getFileCachePath (
@@ -240,7 +242,9 @@ class ScriptTransformer {
240
242
) : Promise < string > {
241
243
const cacheKey = await this . _getCacheKeyAsync ( content , filename , options ) ;
242
244
243
- return this . _createCachedFilename ( filename , cacheKey ) ;
245
+ const tmp = this . _createCachedFilename ( filename , cacheKey ) ;
246
+ // createDirectory(path.dirname(tmp));
247
+ return tmp ;
244
248
}
245
249
246
250
private _getTransformPath ( filename : string ) {
@@ -462,6 +466,7 @@ class ScriptTransformer {
462
466
const { transformer, transformerConfig = { } } =
463
467
this . _getTransformer ( filename ) ?? { } ;
464
468
const cacheFilePath = this . _getFileCachePath ( filename , content , options ) ;
469
+ createDirectory ( path . dirname ( cacheFilePath ) ) ;
465
470
const sourceMapPath = `${ cacheFilePath } .map` ;
466
471
// Ignore cache if `config.cache` is set (--no-cache)
467
472
const code = this . _config . cache ? readCodeCacheFile ( cacheFilePath ) : null ;
@@ -522,6 +527,7 @@ class ScriptTransformer {
522
527
content ,
523
528
options ,
524
529
) ;
530
+ createDirectory ( path . dirname ( cacheFilePath ) ) ;
525
531
const sourceMapPath = `${ cacheFilePath } .map` ;
526
532
// Ignore cache if `config.cache` is set (--no-cache)
527
533
const code = this . _config . cache ? readCodeCacheFile ( cacheFilePath ) : null ;
0 commit comments