Skip to content

Commit

Permalink
fix: handle templates without main package field
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb committed Mar 27, 2020
1 parent 79dbc33 commit 1987721
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/cra-template-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion packages/cra-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 2 additions & 3 deletions packages/react-scripts/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1987721

Please sign in to comment.