-
-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Unable to target a scoped NPM package template #7985
Comments
This functionality seems to be the cause: create-react-app/packages/create-react-app/createReactApp.js Lines 652 to 654 in 971f249
We were able to work around it by specifying the |
I agree, this is something we should aim to fix ASAP. This block of code will go completely in v4, but is needed for legacy support. This check const isValidTemplate = (template) => /^(@[a-z\d][\w-.]+\/)?(cra-template-[a-z\d][\w-.]+)/i.test(template); @klasbj would you like to make a PR? Ping me and I'd be happy to help out. Otherwise, I can look at it this week. |
@mrmckeb Sure, I'll give it a go! |
Thanks again, this is now merged and will be in the release. |
Describe the bug
It is not possible to reference a scoped package with the
--template
switch, e.g.@CompanyName/cra-template-company-react-template
.Did you try recovering your dependencies?
No
Which terms did you search for in User Guide?
N/A
Environment
Steps to reproduce
npx create-react-app@next --scripts-version=@next --template=@klasbj/cra-template-scoped app-name
Expected behavior
The app should have been created based on the template in the scoped package.
Actual behavior
create-react-app tries to instantiate the project based on the NPM package
cra-template-@klasbj/cra-template-scoped
instead, which obviously fails.Full output:
I didn't let it connect to github, hence the errors in the middle.
Reproducible demo
The above template
@klasbj/cra-template-scoped
is available on npm for demo.The text was updated successfully, but these errors were encountered: