Skip to content

Commit 73e581d

Browse files
committed
fix: handle templates without main package field
1 parent 79dbc33 commit 73e581d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-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

+5-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@ 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+
path.join(
111+
require.resolve(`templateName/package.json`, { paths: [appPath] }),
112+
'..'
113+
)
112114
);
113115

114116
let templateJsonPath;

0 commit comments

Comments
 (0)