react-email icon indicating copy to clipboard operation
react-email copied to clipboard

Prettier external package warning

Open yusifaliyevpro opened this issue 1 year ago β€’ 18 comments

Describe the Bug

Hello, I am facing a warning today. I tried to reinstall all packages but it didn't work. I am working with a NextJS 15 project. My pnpm version is 10.7.0

⚠ ./node_modules/.pnpm/@[email protected]_r_54ba43e403e223a8326dd018c58af3ee/node_modules/@react-email/render/dist/node Package prettier can't be external The request prettier/standalone matches serverExternalPackages (or the default list). The package resolves to a different version when requested from the project directory (3.5.3) compared to the package requested from the importing module (3.4.2). Make sure to install the same version of the package in both locations.

Which package is affected (leave empty if unsure)

react-email

Link to the code that reproduces this issue

It is private repo

To Reproduce

It is a package dependency problem

Expected Behavior

There must be no warning

What's your node version? (if relevant)

v22.13.1

yusifaliyevpro avatar Mar 27 '25 08:03 yusifaliyevpro

@react-email/render depends on prettier v3.4.2 and your repo depends on 3.5.3, so there is a conflict and you could override it in your package.json

"pnpm": {
    "overrides": {
      "prettier": "^3.5.3"
    }
}

I think it would be better to loosen the prettier version here, use ^3 or ^3.x.x (if there is a known minimum version), as this compatibility issue has come up a few times

CHC383 avatar Mar 27 '25 17:03 CHC383

In my case, I don't use prettier on my project, so pnpm add prettier doesn't solve it. I had to pnpm add [email protected] to solve it entirely.

angelod1as avatar Mar 27 '25 17:03 angelod1as

I'm not sure prettier should really even be a dependancy for the release?

For the people maintaining this package, sure, but not if you are npm'ing

davecarlson avatar Mar 31 '25 10:03 davecarlson

Hey guys, let's not bundle prettier. Make it a devDependency. It's super messy having to put an override or have to adjust the prettier version to match react-email.

daveycodez avatar Mar 31 '25 17:03 daveycodez

Unfortunately prettier is indeed a dependency for @react-email/render, as it is used in the code. A potential workaround is to unpin the specific version, but it could still cause conflicts in some cases.

CHC383 avatar Mar 31 '25 19:03 CHC383

Same issue here.

 ⚠ ./node_modules/@react-email/render/dist/node
Package prettier can't be external
The request prettier/standalone matches serverExternalPackages (or the default list).
The package resolves to a different version when requested from the project directory (3.5.3) compared to the package requested from the importing module (3.4.2).
Make sure to install the same version of the package in both locations.
$ npm ls prettier
[email protected] /home/alexkadyrov/Projects/custdev
β”œβ”€β”¬ [email protected]
β”‚ └── [email protected] deduped
β”œβ”€β”€ [email protected]
└─┬ [email protected]
  └─┬ @react-email/[email protected]
    └── [email protected]

gruz0 avatar Apr 02 '25 14:04 gruz0

Hey guys delete prettier and switch to Biome plz. Having to put an override for prettier in a package.json for all consumers of my package is very unwieldly.

I will have to update the instructions at https://better-auth-ui.com to tell every dev that they have to run pnpm install prettier manually and then add an override? That's way too much overhead

daveycodez avatar Apr 02 '25 18:04 daveycodez

Yep, agreed. Also coming here as a better auth user btw..

wottpal avatar Apr 03 '25 09:04 wottpal

I explored better-auth.ui right now. Great and usefull projectπŸ‘βœ¨. Really useful, and I’ll definitely be using it in my new projects.

But The react-email should change their version of prettier. While this doesn’t cause errors, pinning package versions isn’t generally a best practice. Using a version range like "^3.4.2" would be more flexible and help avoid unnecessary warnings in the terminal and package sizes as said in the #2026 .

I saw in #2026 that the team is already discussing this, so I’m hopeful it will be updated soon. πŸ™

yusifaliyevpro avatar Apr 03 '25 13:04 yusifaliyevpro

I just ran into this save issue when trying to implement Resend as a transactional email replacement. Resend seems pretty solid, however the pinned dependencies are killing the project. Hoping it's resolved quickly.

edwardrpool avatar Apr 03 '25 21:04 edwardrpool

As previously mentioned, I personally understand why prettier is a dep, not a devDep, but the vast majority of people will not want this, as it is going to massively inflate their bundles. We really shouldnt be using dev tooling like this.

It doesnt help that the resend package includes this no matter what - we have requirement to ship react based emails, just transactional ones, this really should be a separate "opt in" if you are using it

davecarlson avatar Apr 04 '25 06:04 davecarlson

Is there any workarounds for this until it is resolved?

It's making debugging in the console incredibly difficult.

SimtecConsult avatar Apr 14 '25 12:04 SimtecConsult

prettier should be a peer dependency and allow any 3.x.x

capaj avatar Apr 15 '25 18:04 capaj

100% agreed with @davecarlson

wottpal avatar Apr 15 '25 21:04 wottpal

@react-email/render 1.0.6/@react-email/components 0.0.36 have this fixed, and we have already unpinned our dependencies in canary coming soon to the latest releases.

gabrielmfern avatar Apr 16 '25 16:04 gabrielmfern

Hi, @gabrielmfern this resurfaced on render version 1.1.2:

./node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@react-email/render/dist/node
Package prettier can't be external
The request prettier/plugins/html matches serverExternalPackages (or the default list).
The request could not be resolved by Node.js from the project directory.
Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.
Try to install it into the project directory by running npm install prettier from the project directory.

naquiroz avatar Jul 16 '25 03:07 naquiroz

Hi, @gabrielmfern sorry to bother you again. Should we create a new issue for this? I am getting the exact same console log as @naquiroz.

eklekmek07 avatar Aug 01 '25 17:08 eklekmek07

same thing

dr-dark-flames avatar Dec 11 '25 21:12 dr-dark-flames