From 9ef9fcb4189520b2e0fe515366e8bc2f27934299 Mon Sep 17 00:00:00 2001 From: Doron Pagot Date: Thu, 22 Jun 2017 22:53:03 +0300 Subject: [PATCH] fix importing package.json --- packages/react-dev-utils/ModuleScopePlugin.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/react-dev-utils/ModuleScopePlugin.js b/packages/react-dev-utils/ModuleScopePlugin.js index e82831372ee..3d9320c7d60 100644 --- a/packages/react-dev-utils/ModuleScopePlugin.js +++ b/packages/react-dev-utils/ModuleScopePlugin.js @@ -40,21 +40,19 @@ class ModuleScopePlugin { if (relative.startsWith('../') || relative.startsWith('..\\')) { return callback(); } + const requestFullPath = path.resolve( + path.dirname(request.context.issuer), + request.__innerRequest_request + ); const descriptionFileRelativeToRoot = path.relative( request.descriptionFileRoot, - request.descriptionFilePath + requestFullPath ); if (descriptionFileRelativeToRoot === 'package.json') { return callback(); } // Find path from src to the requested file - const requestRelative = path.relative( - appSrc, - path.resolve( - path.dirname(request.context.issuer), - request.__innerRequest_request - ) - ); + const requestRelative = path.relative(appSrc, requestFullPath); // Error if in a parent directory of src/ if ( requestRelative.startsWith('../') || requestRelative.startsWith('..\\')