From 19877214960d70079547464f5a10c9e3c626da06 Mon Sep 17 00:00:00 2001 From: Brody McKee Date: Fri, 27 Mar 2020 11:23:19 +0200 Subject: [PATCH] fix: handle templates without main package field --- packages/cra-template-typescript/package.json | 1 - packages/cra-template/package.json | 1 - packages/react-scripts/scripts/init.js | 5 ++--- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/cra-template-typescript/package.json b/packages/cra-template-typescript/package.json index daf0693456e..4c16d0c0a3a 100644 --- a/packages/cra-template-typescript/package.json +++ b/packages/cra-template-typescript/package.json @@ -8,7 +8,6 @@ "typescript" ], "description": "The base TypeScript template for Create React App.", - "main": "template.json", "repository": { "type": "git", "url": "https://github.com/facebook/create-react-app.git", diff --git a/packages/cra-template/package.json b/packages/cra-template/package.json index b8fd4b871fc..f28004102ff 100644 --- a/packages/cra-template/package.json +++ b/packages/cra-template/package.json @@ -7,7 +7,6 @@ "template" ], "description": "The base template for Create React App.", - "main": "template.json", "repository": { "type": "git", "url": "https://github.com/facebook/create-react-app.git", diff --git a/packages/react-scripts/scripts/init.js b/packages/react-scripts/scripts/init.js index fdc4e0ae624..58ffeb59c3f 100644 --- a/packages/react-scripts/scripts/init.js +++ b/packages/react-scripts/scripts/init.js @@ -106,9 +106,8 @@ module.exports = function( return; } - const templatePath = path.join( - require.resolve(templateName, { paths: [appPath] }), - '..' + const templatePath = path.dirname( + require.resolve(`${templateName}/package.json`, { paths: [appPath] }) ); let templateJsonPath;