-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List requirement to use main
in package.json
#8560
Conversation
Hi @Vinnl, from memory I hit this during testing and failed to document it. I think this is actually a requirement of the Node ecosystem - it is definitely not required by us. @ianschmitz - what do you think, it's probably worth pointing out for people that don't use our templates as a reference. |
Yeah that's what I presumed - that it didn't have to point to anything in particular, but that the key did have to be present. What the experience looked like for me was to first try and write a template using the documentation in its current shape, then getting the error message above, and then painstakingly comparing everything in my template to the official ones - took me quite a while to spot the difference. I could add a note that it's not required by CRA, but that it won't work if you don't add the key, but since that's not really actionable information, I'm not sure that it adds value. |
Yeah it looks like it's because we're doing a |
Good point @ianschmitz. @Vinnl, would you like to take a look at the That code is responsible for getting the path of the template package. |
@mrmckeb Unfortunately I'm not too familiar with I did find
So that does imply that |
Without trying that's my guess how it works under the hood. I've used something like this in past:
|
Hi @Vinnl, did you want to take a look at this feature - as per the suggestion by @ianschmitz? I feel that would be a great addition and I'm happy to work with you on it. If not, let me know and I can pick it up this week :) |
Hi @mrmckeb, I've left a suggestion for a replacement above, and while I'd be happy to work on it, I cannot really justify the time investment of setting up a dev environment, learning about Webpack's internals and verifying that it does what I hope it does. So maybe just updating the docs is the way to go in the meantime. |
@Vinnl, I understand open source can be time consuming, we are all volunteers on this project which is why we can be slow to respond. I'll take a look at it over the week, as fixing the root cause would be a better solution. |
Super! And to emphasise, I didn't expect you to fix it instead. I understand that it can be time-consuming and is a volunteer effort; unfortunately, the small docs fix was about all I can afford to contribute, but obviously it'd be great if someone can actually make it unnecessary. |
No problem, I will make some time for this as I think others will hit the issue too. |
Just to chime in that I just hit this issue as well! I initially removed main pointing to src/index.js because that errored, tried an empty main after some of the discussion here, and ended on main pointing to template.json, which worked. Definitely was a confusing hurdle in trying to create a custom template, so an update to the docs would be much appreciated by future devs I think! |
Might I suggest merging this in, and then later reverting it together with the fix that results in it no longer being necessary? |
Hi all, I'll close this off in favour of #8734 - which we'll try to get out in the coming days. |
I'm not 100% sure whether
main
is required to point totemplate.json
, but when I did not include the key altogether, I ran into the following error: