@@ -249,7 +249,7 @@ function serializeHashContent(module) {
249
249
// };
250
250
251
251
function HardSourceWebpackPlugin ( options ) {
252
- this . options = options ;
252
+ this . options = options || { } ;
253
253
}
254
254
255
255
HardSourceWebpackPlugin . prototype . getPath = function ( dirName , suffix ) {
@@ -280,7 +280,11 @@ HardSourceWebpackPlugin.prototype.apply = function(compiler) {
280
280
logger . lock ( ) ;
281
281
282
282
if ( ! options . cacheDirectory ) {
283
- options . cacheDirectory = 'node_modules/.cache/hard-source/[confighash]' ;
283
+ options . cacheDirectory = path . resolve (
284
+ process . cwd ( ) ,
285
+ compiler . options . context ,
286
+ 'node_modules/.cache/hard-source/[confighash]'
287
+ ) ;
284
288
}
285
289
286
290
this . compilerOutputOptions = compiler . options . output ;
@@ -395,8 +399,8 @@ HardSourceWebpackPlugin.prototype.apply = function(compiler) {
395
399
! compiler . options . recordsInputPath &&
396
400
! compiler . options . recordsPath
397
401
) {
398
- compiler . options . recordsInputPath =
399
- this . getPath ( 'node_modules/.cache/hard-source/[confighash]/records.json' ) ;
402
+ options . recordsInputPath = path . join ( options . cacheDirectory , 'records.json' ) ;
403
+ compiler . options . recordsInputPath = this . getPath ( options . recordsInputPath ) ;
400
404
}
401
405
if ( options . recordsOutputPath || options . recordsPath ) {
402
406
if ( compiler . options . recordsOutputPath || compiler . options . recordsPath ) {
@@ -421,8 +425,9 @@ HardSourceWebpackPlugin.prototype.apply = function(compiler) {
421
425
! compiler . options . recordsOutputPath &&
422
426
! compiler . options . recordsPath
423
427
) {
428
+ options . recordsOutputPath = path . join ( options . cacheDirectory , 'records.json' ) ;
424
429
compiler . options . recordsOutputPath =
425
- this . getPath ( 'node_modules/.cache/hard-source/[confighash]/records.json' ) ;
430
+ this . getPath ( options . recordsOutputPath ) ;
426
431
}
427
432
428
433
var cacheDirPath = this . getCachePath ( ) ;
0 commit comments