-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Errors/Warnings during build #87
Comments
Hi and thanks for the report! There was a similar error reported in #32 by @Pixelatex and @timonweber replied in the thread more recently with the same issue. Not sure if they figured out the issue eventually? In any case it would be very helpful if you could include a reproduction like it's mentioned in the issue template, otherwise it's pretty hard to diagnose. Thanks! |
Closing due to inactivity … Please provide a reproduction if you're still seeing this error! |
I was moving away from i18next to next-intl, and I came across the issue myself too, and for me it was happening due to a use of a component inside of Here's how my _app.tsx looks likeimport type { AbstractIntlMessages } from "next-intl";
import type { AppProps } from "next/app";
import { Provider as JotaiProvider } from "jotai";
import { NextIntlProvider } from "next-intl";
import { ThemeProvider } from "next-themes";
import { useRouter } from "next/router";
import nProgress from "nprogress";
import { useEffect } from "react";
import { Footer } from "@/components/Footer";
import { Navigation } from "@/components/Navigation";
import "@/assets/styles/cards.scss";
import "@/assets/styles/main.scss";
import "@/assets/styles/markdown.scss";
import "@/assets/styles/nprogress.scss";
const MyApp = ({ Component, pageProps }: AppProps<{ messages?: AbstractIntlMessages }>) => {
const router = useRouter();
useEffect(() => {
nProgress.configure({
showSpinner: false,
easing: "ease",
speed: 250,
});
console.log("nProgress configured");
const handleStart = () => {
nProgress.start();
};
const handleStop = () => {
setTimeout(() => {
nProgress.done();
}, 100);
};
router.events.on("routeChangeStart", handleStart);
router.events.on("routeChangeComplete", handleStop);
router.events.on("routeChangeError", handleStop);
return () => {
router.events.off("routeChangeStart", handleStart);
router.events.off("routeChangeComplete", handleStop);
router.events.off("routeChangeError", handleStop);
};
}, []);
return (
<NextIntlProvider messages={pageProps.messages}>
<JotaiProvider>
<ThemeProvider attribute="class">
<div className="app-container mx-auto max-w-screen-2xl gap-4 px-2">
<Navigation />
<Component {...pageProps} />
<Footer />
</div>
</ThemeProvider>
</JotaiProvider>
</NextIntlProvider>
);
};
export default MyApp; And here's my Footer.tsx (Navigations is just way too big)import type { FC } from "react";
import { useTranslations } from "next-intl";
import { ExternalLink } from "@/components/ExternalLink";
import { DiscordLogo } from "@/components/icons/DiscordLogo";
import { GitHubLogo } from "@/components/icons/GitHubLogo";
export const Footer: FC = () => {
const t = useTranslations();
return (
<footer className="footer grid grid-cols-1 grid-rows-[auto_auto] border-t py-6 px-4 text-sm text-gray-400 lg:grid-cols-[1fr_auto] lg:grid-rows-1">
<p>
{t.rich("footer.affiliation", {
officialWebsite: (children) => (
<ExternalLink href="https://www.mihoyo.com/">{children}</ExternalLink>
),
})}
<br />
{t.rich("footer.copyright", {
officialWebsite: (children) => (
<ExternalLink href="https://www.mihoyo.com/">{children}</ExternalLink>
),
})}
</p>
<div className="mt-6 flex flex-col gap-x-6 gap-y-2 place-self-start font-bold lg:mt-0 lg:flex-row lg:place-self-center">
<ExternalLink href="https://github.com/kitsune-guuji/gvp">
<div className="flex flex-row items-center gap-x-2">
<GitHubLogo className="inline-block h-auto w-4" />
<p>GitHub</p>
</div>
</ExternalLink>
<ExternalLink href="https://discord.gg/[REDACTED]">
<div className="flex flex-row items-center gap-x-2">
<DiscordLogo className="inline-block h-auto w-4" />
<p>Discord</p>
</div>
</ExternalLink>
</div>
</footer>
);
}; If I keep Hopefully this was somewhat helpful 😅 |
Just a little followup, moving the |
Hey @TenkoSpirit and thanks for chiming in! I think what's probably happening here is this: Next.js creates a 404 page at build time where the
The fix is probably to create a custom 404 page where you define Let me know if this helps! |
Hello @amannn! I actually do have a custom 404 page in my project with messages in |
Ah, true! I just checked out your project and found that the errors are caused by the absence of the 500 error page. That page is also generated at build time. After adding such a page with messages, the warning goes away for me in your project. Let me know if this helps! Btw. I noticed you migrated away from |
@amannn oh, alright, will try that a bit later once I get back to my PC! As for switching away from |
Thanks for the feedback, I'm really glad to hear when next-intl works well for you! 🙌 Let me know if you run into something else and good luck with your project! |
Happy to share that creating a custom |
Really cool to hear! 🙌 |
Hey there! First off I'd like to say thanks for the library and, at the same time, apologize if this isn't the right place for questions.
I've been using this library to translate a website and during build time on Netlify I keep seeing these errors:
This happens for every key, but they're not missing as the site renders properly in all available languages. All static pages are translated (I checked the HTML files Next generated.)
Our
_app.js
uses the provider like this:If I
console.log(pageProps.messages)
all the keys are logged as expected. Client and server side.On pages I'm accessing messages through
getStaticProps
andgetServerSideProps
by returning amessages
prop:Let me know if you need more info. I tried to simplify the snippets by removing unrelated code.
Thanks!
The text was updated successfully, but these errors were encountered: