Closed mr-scrpt closed 11 months ago
I apologise. The error is gone. I don't understand why, it just gone, there were other errors with clear description, I fixed them and the build works now
I apologise. The error is gone. I don't understand why, it just gone, there were other errors with clear description, I fixed them and the build works now
I'm facing the same error, but there are no other errors that I could potentially fix.
I apologise. The error is gone. I don't understand why, it just gone, there were other errors with clear description, I fixed them and the build works now
I'm facing the same error, but there are no other errors that I could potentially fix.
Same, No idea what to look at. Tried using the latest canary versions of nextjs but no luck.
Same issue here.
same here , cant proceed to the build
Google says that I need to downgrade Resend package to version 1, but I don't use this package
I am using resend
and ran into this. I thought I would share the links to the issues over there for anyone else who comes across this issue. It might also help to uncover a root cause?
The resolution from https://github.com/resendlabs/resend-node/issues/256 is to upgrade resend
to "^2.1.0-canary.1"
. The PR with the fix - https://github.com/resendlabs/resend-node/pull/259
I also have this issue and I do not use resend
The resend
issue linked to https://github.com/vercel/next.js/issues/39375 which has a helpful comment https://github.com/vercel/next.js/issues/39375#issuecomment-1380443503
Alright. I've researched this for quite some while now. What I reported above seems to hold true.
Now for people searching for a SOLUTION only I have exactly 2 proposals for you:
Clean one: Go to the affected repository of the "problematic" library and make sure they export the ESM files with .mjs extension and/or have it set type: "module" in the package.json
Workaround: Abuse your next.config.js:
const nextConfig = { experimental: { transpilePackages: ["problematic-package", "other-problematic-package", "etc", "..."], }, } Warning: This isn't a clean solution so only do this when you are beyond desperate.
weirdly enough, fixing some other code in development mode solved this issue for me. If that's the case, I would presume it's a bug with the next compiler as well (considering this happened only to resend).
I'm getting this error again. I don't understand what the reason is. There is no any explanation for it. The first time it just disappeared, probably due to refactoring, but now I don't see any errors, but I can't look through every file of the project, maybe there are errors somewhere, but there may be thousands of files and where exactly the error is and what it may be is not clear at all
I found a function that causes an error in my project.
import * as cheerio from 'cheerio'
export const parseHTMLToString = (html: string) => {
const $ = cheerio.load(html)
return $.text()
}
Seems like a bug in the next/swc compiler somewhere during esm resolution.
Google says that I need to downgrade Resend package to version 1, but I don't use this package
I am using
resend
and ran into this. I thought I would share the links to the issues over there for anyone else who comes across this issue. It might also help to uncover a root cause?The resolution from resendlabs/resend-node#256 is to upgrade
resend
to"^2.1.0-canary.1"
. The PR with the fix - resendlabs/resend-node#259
this worked for me
We landed a fix in 14.0.4-canary.33, I cloned the repro and built successfully with that version. Can you try upgrade? Lmk if the issue is still present or resolved
@huozhi I just tried this 14.0.4-canary.33 but I'm still having this issue. Specifically having it with @ucast/mongo
▲ Next.js 14.0.4-canary.33
- Environments: .env
Failed to compile.
./node_modules/@casl/prisma/dist/es6m/index.mjs + 7 modules
Cannot get final name for export 'defaultParsers' of ./node_modules/@ucast/mongo/dist/es6m/index.mjs
> Build failed because of webpack errors
Creating an optimized production build .
@samasri does latest canary work for it? if it still doesn't work can you file a new reproduction for your case, thanks.
It still doesn't. I'll file a new reproduction, thank you
I'm facing the same issue, I have already did everything based on #58643 issue also resend
issue comments. but I still faced that issue.
> next build
▲ Next.js 14.0.1
- Environments: .env
Failed to compile.
./node_modules/.pnpm/html-to-text@9.0.5/node_modules/html-to-text/lib/html-to-text.mjs + 24 modules
Cannot get final name for export 'encodeXML' of ./node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/index.js
> Build failed because of webpack errors
Creating an optimized production build . ELIFECYCLE Command failed with exit code 1.
@devlopersabbir please upgrade to latest nextjs, you're using the version (14.0.1) without the fix
@huozhi no dear,
here is my all dependency.. please check and let me know.
"dependencies": {
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@react-email/components": "^0.0.12",
"@react-email/tailwind": "^0.0.13",
"@types/node": "^20.10.4",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.17",
"autoprefixer": "^10.4.16",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"eslint": "^8.55.0",
"eslint-config-next": "^14.0.4",
"lucide-react": "^0.263.1",
"next": "v14.0.5-canary.12",
"next-themes": "^0.2.1",
"postcss": "^8.4.32",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"resend": "^2.0.0",
"sonner": "^1.2.4",
"swiper": "^10.1.0",
"tailwind-merge": "^1.14.0",
"tailwindcss": "3.3.3",
"tailwindcss-animate": "^1.0.6",
"typescript": "5.1.6"
}
Another thing, When I used contact form action I got this issue but without it works perfectly as I expected. So, can you help me to find out my issue please.
"use server";
import React from "react";
import { Resend } from "resend";
import ContactFormEmail from "@/email/ContactFormEmail";
import { validateString, getErrorMessage } from "@/validator/validator";
const resend = new Resend(process.env.RESEND_API_KEY);
export const sendEmail = async (formData: FormData) => {
const senderName = formData.get("senderName");
const senderEmail = formData.get("senderEmail");
const senderMessage = formData.get("message");
// simple server-side validation
if (!validateString(senderName, 500)) return { error: "Invalid sender name" };
if (senderName.length < 5) return { error: "Name length is too low!" };
if (!validateString(senderEmail, 500))
return { error: "Invalid sender email" };
if (!validateString(senderMessage, 5000)) return { error: "Invalid message" };
if (senderMessage.length < 5)
return {
error: "Message length is too low!",
};
let data;
try {
data = await resend.emails.send({
from: "Contact Form <onboarding@resend.dev>",
// TODO: Change email (matalondaniel@gmail.com)
to: "matalondaniel@gmail.com",
subject: `${senderName} want to contact from Taboverrider`,
reply_to: senderEmail,
react: React.createElement(ContactFormEmail, {
message: senderMessage,
senderEmail: senderEmail,
}),
});
} catch (error: unknown) {
return {
error: getErrorMessage(error),
};
}
return {
data,
};
};
import React from "react";
import {
Html,
Body,
Head,
Heading,
Hr,
Container,
Preview,
Section,
Text,
} from "@react-email/components";
import { Tailwind } from "@react-email/tailwind";
type ContactFormEmailProps = {
message: string;
senderEmail: string;
};
export default function ContactFormEmail({
message,
senderEmail,
}: ContactFormEmailProps) {
return (
<Html>
<Head />
<Preview>New message from Taboverrider website</Preview>
<Tailwind>
<Body className="bg-gray-100 text-black">
<Container>
<Section className="bg-white borderBlack my-10 px-10 py-4 rounded-md">
<Heading className="leading-tight">
You received the following message from the contact form
</Heading>
<Text>{message}</Text>
<Hr />
<Text>The sender's email is: {senderEmail}</Text>
</Section>
</Container>
</Body>
</Tailwind>
</Html>
);
}
@devlopersabbir
Add transpilePackages: ['html-to-text'],
to next config.
works for me!
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Link to the code that reproduces this issue
https://github.com/mr-scrpt/stackoverflow/tree/26_06-edit-profile
To Reproduce
Start app
pnpm build
oryarn build
ornpm build
Current vs. Expected behavior
Current Failed to compile.
Expected Build app
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
Everything was working correctly a few days ago. Today I noticed a problem. Initially the project was on next 14.0.1, later I upgraded it to 14.0.3, tried downgrade to 14.0.1 and upgrade to 14.0.4-canary.4 - didn't solve the problem. Google says that I need to downgrade Resend package to version 1, but I don't use this package No problems detected in development mode