Skip to content
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

Add option to enable Turbopack with create-next-app #65924

Closed
leerob opened this issue May 18, 2024 · 7 comments · Fixed by #65926
Closed

Add option to enable Turbopack with create-next-app #65924

leerob opened this issue May 18, 2024 · 7 comments · Fixed by #65926
Labels
create-next-app Related to our CLI tool for quickly starting a new Next.js application. good first issue Easy to fix issues, good for newcomers linear: next Confirmed issue that is tracked by the Next.js team.

Comments

@leerob
Copy link
Member

leerob commented May 18, 2024

What is the update you wish to see?

create-next-app currently shows a list of options when setting up your Next.js application.

CleanShot 2024-05-18 at 09 14 41@2x

We'd like to add an option that matches the other style for Turbopack. It should default to No until it is stable. Please use the following format for the option:

Would you like to use Turbopack for next dev? (RC) … No / Yes

It's worth noting there are multiple different templates (e.g. App Router, non-App Router, Tailwind, non-Tailwind) and we'll need to make sure selecting this option works for all of them.

The specific code change needed is to change the package.json script for dev from next dev to next dev --turbo.

Is there any context that might help us understand?

The docs page should also be updated in the PR to include the new option.

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/api-reference/create-next-app

@leerob leerob added good first issue Easy to fix issues, good for newcomers create-next-app Related to our CLI tool for quickly starting a new Next.js application. labels May 18, 2024
Copy link
Contributor

The issue was marked with the good first issue label by a maintainer.

This means that it is a good candidate for someone interested in contributing to the project, but does not know where to start.

To get started, read the Contributing Guide. When you are ready, open a PR and link back to this issue in the form of adding Fixes #1234 to the PR description, where 1234 is the issue number. This will automatically close the issue when the PR gets merged, making it easier for us to keep track of what has been fixed.

Please remember to add tests to confirm your code changes will fix the issue and we do not regress in the future.

If you have any questions, feel free to ask below or on the PR. Generally, you don't need to @mention anyone directly, as we will get notified anyway and will respond as soon as we can.

Note

There is no need to ask for permission "can I work on this?" Please, go ahead if there is no linked PR 🙂

@leerob
Copy link
Member Author

leerob commented May 18, 2024

Woohoo! Thank you three, we can combine efforts now 😄

@devjiwonchoi
Copy link
Contributor

@mertcanaltin Hi, awesome work!! I'd propose combining to @Arindam200's PR as this "issue" was encouraging new contributors to Next.js!

@mertcanaltin
Copy link
Contributor

Of course, we can combine it, everyone was great, thank you for your efforts ❤️

@Arindam200
Copy link
Contributor

Thanks @devjiwonchoi @mertcanaltin for your Support!

@github-actions github-actions bot added the linear: next Confirmed issue that is tracked by the Next.js team. label May 20, 2024
samcx added a commit that referenced this issue May 20, 2024
This PR addresses an issue where the `dev` script in `package.json` was
not correctly updated to use the `--turbo` option when specified. The
changes ensure that the `dev` script is set to `next dev --turbo` if the
`turbo` option is enabled.

### Changes:
1. **Function Modification**:
- Updated the `modifyPackageJson` function to include a check for the
`turbo` parameter.
- If `turbo` is true, the `dev` script in `package.json` is set to `next
dev --turbo`.
   - If `turbo` is false, the `dev` script remains `next dev`.

2. **Integration in App Creation**:
- Integrated the `modifyPackageJson` function into the app creation
process to ensure the `dev` script is correctly set based on the `turbo`
parameter.

### Testing:
- Verified that the `dev` script in `package.json` is correctly updated
to `next dev --turbo` when the `turbo` option is enabled.
- Ensured that the `dev` script remains `next dev` when the `turbo`
option is not enabled.

### Related Issues:
- Fixes #65924

### Notes:
- This change ensures that developers opting to use Turbopack for
development will have the correct script set up automatically.

---------

Signed-off-by: Arindam Majumder <arindammajumder2020@gmail.com>
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: devjiwonchoi <devjiwonchoi@gmail.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Sam Ko <sam@vercel.com>
@leerob
Copy link
Member Author

leerob commented May 20, 2024

We did it! Thank you all so much 🥳

@mirasayon
Copy link
Contributor

We are the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-next-app Related to our CLI tool for quickly starting a new Next.js application. good first issue Easy to fix issues, good for newcomers linear: next Confirmed issue that is tracked by the Next.js team.
Projects
None yet
5 participants