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

Inline next-transpile-modules #35150

Closed
jaredpalmer opened this issue Mar 8, 2022 · 7 comments
Closed

Inline next-transpile-modules #35150

jaredpalmer opened this issue Mar 8, 2022 · 7 comments

Comments

@jaredpalmer
Copy link
Contributor

Describe the feature you'd like to request

As a monorepo user that leverages yarn, npm, pnpm workspaces, Next.js requires an external plugin that degrades build performance (next-transpile-modules) because of symlink quirks.

Describe the solution you'd like

Inline/enable a similar feature to next-transpile-modules directly into Next.js.

For example, imagine there is a package called @acme/ui in a workspaces monorepo.

// package.json
{
  "name": "my-app",
  "dependencies": {
     "next": "latest",
     "@acme/ui": "*" // or "workspace:*" in pnpm and yarn 2+
   }
}
// next.config.js
module.exports = {
    transpileModules: ['@acme/ui'] 
}

Describe alternatives you've considered

n/a

@leerob

This comment was marked as off-topic.

@remorses
Copy link
Contributor

remorses commented Apr 9, 2022

An alternative would be to always transpile paths that do not contain node_modules

This is always valid in yarn, npm and pnpm workspaces, the local packages real paths (the path linked by symlinks) will always be in a directory out of node_modules

@timneutkens
Copy link
Member

@remorses that's already covered by externalDir for TypeScript files: https://github.com/timneutkens/next.js/blob/canary/packages/next/build/webpack-config.ts#L866-L869

I agree that you shouldn't have to configure what packages exist in a workspaces setup, basically expanding externalDir to all code. Even with that change there's still the case of people wanting to downlevel specific packages to run in older browsers.

@matamatanot

This comment was marked as off-topic.

@matamatanot
Copy link
Contributor

@jaredpalmer
Is this feature already implemented?
https://beta.nextjs.org/docs/api-reference/next.config.js#transpilepackages

The next-transpile-modules is still used in turborepo docs. Is there any plan to change it?
https://turbo.build/repo/docs/handbook/sharing-code/internal-packages#6-configuring-your-app

@matamatanot
Copy link
Contributor

@timneutkens shared the details here. Sorry for that I had missed it.

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants