-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
email command fails within pnpm workspace #881
Comments
Also just ran into this |
I am also having this issue when using it though pnpm workspaces. For now the only work around I use is to go into the .react-email folder and do a |
The issue is here: https://github.com/resendlabs/react-email/blob/490e0356685c1a6406c89620687725d0b98ad53b/packages/react-email/source/utils/sync-package.ts#L6 and doesn't seem to take into account pnpm or pnpm workspaces. Using a node_modules/dependency script (https://github.com/resendlabs/react-email/blob/490e0356685c1a6406c89620687725d0b98ad53b/packages/react-email/source/utils/start-server-command.ts#L15 and https://github.com/resendlabs/react-email/blob/490e0356685c1a6406c89620687725d0b98ad53b/client/package.json#L7) is a really weird way to spin up a process. The concept of package binaries exists so authors don't have to do those kinds of shenanigans. |
Alright fast followup: If you run I maintain that this is a pretty bad way to ship a dev server, but that's a workaround that requires some manual steps. If you're using a build tool like moon, this step can probably be automated. |
Confirmed, @shellscape solution resolves it. Would still like to see this fixed as well though. |
Can we configure the client to work with |
+1 |
Running into this now as well |
+1 |
@bukinoshita If I understand correctly, the current model of the preview server is:
This seems overly complex. If someone is using the I'd be glad to work on a PR for the aforementioned change if it's relevant |
This will be a sort of replacement until resend/react-email#960 is merged. Waiting on resend/react-email#881
Any progress on this? @JasonMan34 Could you please provide more details on your solution? How would you use next cli to fix this issue? I could fork and use your solution until the fix has been released. Thank you! |
The Dev X is bad, I get a tons of errors. Why can't we use pnpm as default ? Fixed it on my end by |
I'm using this patch as a workaround to use this package in a # patches/react-email@1.9.5.patch
diff --git a/dist/source/utils/install-dependencies.js b/dist/source/utils/install-dependencies.js
index 24f4a82f14037a4e341775fe4f273016adf8ac2e..155ff41d5d3bfb3d185f774703bcd1033096580d 100644
--- a/dist/source/utils/install-dependencies.js
+++ b/dist/source/utils/install-dependencies.js
@@ -11,6 +11,10 @@ const ora_1 = __importDefault(require("ora"));
const log_symbols_1 = __importDefault(require("log-symbols"));
const close_ora_on_sigint_1 = require("./close-ora-on-sigint");
const installDependencies = async (packageManager) => {
+ if(packageManager === 'pnpm'){
+ console.warn(`\n🚨🚨🚨🚨🚨🚨\nUsing \`npm\` instead of \`${packageManager}\` to install react-email preview app dependencies\nThis patch should be removed when react-email can support existing in a pnpm workspace.\nsee: https://github.com/resendlabs/react-email/issues/881\n🚨🚨🚨🚨🚨🚨\n`);
+ packageManager = 'npm';
+ }
const spinner = (0, ora_1.default)('Installing dependencies...\n').start();
(0, close_ora_on_sigint_1.closeOraOnSIGNIT)(spinner);
shelljs_1.default.cd(path_1.default.join(constants_1.REACT_EMAIL_ROOT)); |
pretty easy workaround is to add the .react-email folder to your packages:
- "packages/*"
- "apps/**"
- "apps/email/.react-email" edit: to add more explanation, pnpm workspaces don't look for hidden directories that start with |
We experienced the same issue in our monorepo, this workaround worked for us. |
100% agree, finally getting around to looking into react email. Sounded promising, but now I see this and I feel like it was made with little thought to how fragile this approach is. |
This is not a good developer experience, I am fighting with the tool that's suppose to make our life easier for working with emails. Workaround, step by step:
Here's the structure of the emails package I am housing my setup within. In the root of my mono repo I have
It would be nice if the default package manager could be selected via a cli arg. Instead of it defaulting to whatever it finds on the system first. You might also need to add it to ProblemIf you clone the repo from scratch, since
|
Describe the Bug
Following the manual setup inside a pnpm monorepo with a
pnpm-workspace.yaml
in the root, the email command fails like this:Turns out a script was running a
pnpm install
command, but since it's in the workspace, it simply installed the other packages, but skipped the new one since it doesn't match a pattern.I solved this by adding
[package-path]/.react-email
inpnpm-workspace.yaml
. Not sure the best general solution. Posting here mainly to help anyone else hitting the same issue.Which package is affected (leave empty if unsure)
react-email
Link to the code that reproduces this issue
https://react.email/docs/getting-started/manual-setup
To Reproduce
Expected Behavior
The
email
command would succeed, or at least provide a clearer error.What's your node version? (if relevant)
No response
The text was updated successfully, but these errors were encountered: