Skip to content

Commit e0b179c

Browse files
authored
fix: handle templates without main package field (#8734)
1 parent 4cbb003 commit e0b179c

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

packages/cra-template-typescript/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"typescript"
99
],
1010
"description": "The base TypeScript template for Create React App.",
11-
"main": "template.json",
1211
"repository": {
1312
"type": "git",
1413
"url": "https://github.com/facebook/create-react-app.git",

packages/cra-template/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"template"
88
],
99
"description": "The base template for Create React App.",
10-
"main": "template.json",
1110
"repository": {
1211
"type": "git",
1312
"url": "https://github.com/facebook/create-react-app.git",

packages/react-scripts/scripts/init.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,8 @@ module.exports = function(
106106
return;
107107
}
108108

109-
const templatePath = path.join(
110-
require.resolve(templateName, { paths: [appPath] }),
111-
'..'
109+
const templatePath = path.dirname(
110+
require.resolve(`${templateName}/package.json`, { paths: [appPath] })
112111
);
113112

114113
let templateJsonPath;

0 commit comments

Comments
 (0)