-
Notifications
You must be signed in to change notification settings - Fork 26k
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
[create-next-app, Yarn, linux/Darwin] Fresh Next projects can't be pushed to GitHub due to size of tracked @next/swc binary #65586
Comments
Could the templates' default Yarn suggests that |
Hi, Would you mind opening a PR with these set of changes? No idea why these were not included, but most likely, because it is very much specific to that package manager, and it was just overlooked. |
@icyJoseph sounds good. I've created #65823 Do you suppose that this something that should be addressed in the Next.js examples as well? |
…ty with Yarn recommendations (#65823) ### What? Updates create-next-app's templates' `.gitignore` files for parity with [Yarn's official recommendations](https://v3.yarnpkg.com/getting-started/qa#which-files-should-be-gitignored), accounting for Yarn's modern Plug-n-Play functionality. Fixes #65586 ### Why? New projects initialized with create-next-app presently add various extraneous files from the Yarn cache to the initial commit. This is most notable in the case of the Next SWC binary, which may exceed 100M in some environments and prevent users from pushing their new projects to free GitHub repositories without rewriting the commit history or setting up Git LFS. ### How? I've opted to follow the recommendations for non-[Zero-Install](https://yarnpkg.com/features/caching#zero-installs) configurations as Zero-Install may necessitate additional configuration and present additional complications for unsuspecting users, so I think it's best left up to the user to opt-in. Contrary to the example `.gitignore`s provided by Yarn, I've excluded the `.yarn/sdks` directory as it contains IDE-specific tooling which I think is also best left up to the user to opt-in to including. I have retained the current `.gitignore`'s exclusion of the `/.pnp` directory for backwards compatibility with older versions of Yarn.
Link to the code that reproduces this issue
https://github.com/bosconian-dynamics/cna-repro-yarn-pnp-gh
Note: the issue is itself the inability to push repos which create-next-app produces to GitHub, and as such it prevents me from creating a minimal reproduction repository. The repo above is a dummy to satisfy the issue template requirements.
To Reproduce
In a WSL2 Ubuntu x64 environment (or likely other linux/unix environments):
yarn create next-app foobar
cd foobar
git remote add origin https://github.com/xxx/foobar
git push origin main
Current vs. Expected behavior
Observation
In linux/unix environments (or at the very least in WSL2 Ubuntu 20 x64, and evidently Darwin x64), Yarn PnP in combination with create-next-app's templates'
.gitignore
files result in create-next-app creating project repositories with an initial commit which cannot be pushed to free GitHub repositories due to the 100M file size limitation. The large file in question appears to be the Next compiler which resides at the following location in my Next repositories:In my environment, the
git push
operation produces the following output:Resolving the issue necessitates a fair bit of research on the end-user's part, and ultimately the modification of the default
.gitignore
file provided by the templates as well as squashing or rewriting the repo's history to exclude the problematic files. Alternately - if users instead follow the advice suggested by thegit
error - they may end up down a different rabbit hole, setting up Git LFS (and likely engaging GitHub's LFS services which may incur costs in short order) just to handle the SWC binary.The issue is compounded in downstream tools such as Cloudflare's
create-cloudflare
, which themselves may create additional commits on top of the one which create-next-app makes, further cementing the problematic file's inclusion in the fresh project repository's history.Expectation
Project repositories created via create-next-app should be able to be pushed to a free GitHub repository immediately, without requiring the end-user to modify default files and squashing/rewriting repository history or set up Git LFS.
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP Wed Mar 2 00:30:59 UTC 2022 Binaries: Node: 20.11.1 npm: 10.2.4 Yarn: 4.2.2 pnpm: N/A Relevant Packages: next: 14.1.0 eslint-config-next: 14.1.0 react: 18.3.1 react-dom: 18.3.1 typescript: 5.4.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
create-next-app
Which stage(s) are affected? (Select all that apply)
Other (Deployed)
Additional context
This issue has been discussed within the context of Darwin in April of 2023 - and other unknown environments in the time since - see #48956
The text was updated successfully, but these errors were encountered: