这是indexloc提供的服务,不要输入任何密码
Skip to content

refactor(examples): remove duplicate Next.js plugin in examples #10620

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

JeongHwan-dev
Copy link
Contributor

Description

Removes duplicate Next.js TypeScript plugin configuration from examples/.../apps/web/tsconfig.json.

The "next" plugin was configured in two places:

  • packages/typescript-config/nextjs.json (shared config)
  • apps/web/tsconfig.json (duplicate)

Since the app already extends the shared config, the duplicate plugin definition is unnecessary.

File: examples/.../apps/web/tsconfig.json

Removed:

"compilerOptions": {
  "plugins": [
    {
      "name": "next"
    }
  ]
}

The plugin is already inherited from @repo/typescript-config/nextjs.json.

@JeongHwan-dev JeongHwan-dev requested a review from a team as a code owner July 1, 2025 12:07
@turbo-orchestrator turbo-orchestrator bot added area: examples Improvements or additions to examples needs: triage New issues get this label. Remove it after triage labels Jul 1, 2025
Copy link

vercel bot commented Jul 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 19, 2025 7:01pm

Copy link

vercel bot commented Jul 1, 2025

@JeongHwan-dev is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@anthonyshew
Copy link
Contributor

I believe these were there because Next.js used to add them back when you run next build or next dev. Is this no longer the case?

@JeongHwan-dev
Copy link
Contributor Author

I believe these were there because Next.js used to add them back when you run next build or next dev. Is this no longer the case?

@anthonyshew
Thanks! I double-checked with the latest version of Next.js, and it seems that it no longer adds the "next" plugin automatically to tsconfig.json when running next build or next dev.

Copy link
Contributor

@anthonyshew anthonyshew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into it!

Copy link
Contributor

@anthonyshew anthonyshew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh, looks like I was too optimistic. I tried to run the with-tailwind build locally and it looks like the build fails now with this error:

> next build

 ⨯ Failed to load next.config.ts, see more info here https://nextjs.org/docs/messages/next-config-error

> Build error occurred
[TypeError: Cannot read properties of undefined (reading 'baseUrl')]

Fix "Cannot read properties of undefined (reading 'baseUrl')" error
in Next.js build by adding baseUrl configuration to tsconfig.json.
@JeongHwan-dev
Copy link
Contributor Author

Uh oh, looks like I was too optimistic. I tried to run the with-tailwind build locally and it looks like the build fails now with this error:

> next build

 ⨯ Failed to load next.config.ts, see more info here https://nextjs.org/docs/messages/next-config-error

> Build error occurred
[TypeError: Cannot read properties of undefined (reading 'baseUrl')]

@anthonyshew

Thanks for catching this! I've fixed the issue by adding baseUrl: "." to the compilerOptions in the tsconfig.json files for both the docs and web apps in the with-tailwind example.

The error was occurring because Next.js was trying to access the baseUrl property from the TypeScript configuration, but it wasn't defined in the extended config. This should resolve the build failure.

Changes made:

  • Added baseUrl: "." to examples/with-tailwind/apps/docs/tsconfig.json
  • Added baseUrl: "." to examples/with-tailwind/apps/web/tsconfig.json

The build should now complete successfully. ✅

Copy link
Contributor

@anthonyshew anthonyshew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. with-tailwind has that need because it's using next.config.ts instead of .js. Today, I learned.

Thanks for doing this!

Copy link
Contributor

@anthonyshew anthonyshew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was once again too optimistic. My apologies. I don't think we'll be able to merge this because of how Next.js works.

When I run turbo build in the basic example, these log lines appear:

Your tsconfig.json extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experien
ce, we recommend adding the Next.js plugin (`"plugins": [{ "name": "next" }]`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs
/app/api-reference/config/typescript#the-typescript-plugin

If we remove that, we'll get an issue the next day about that log line. I can guarantee it, going off of past experience. 😄 Unless there's a way to make it so that we can remove the plugin from the applications' configuration and not see a log about it being missing, I don't think we'll be able to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: examples Improvements or additions to examples needs: triage New issues get this label. Remove it after triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants