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

Cannot Import serverSideTranslations #1092

Closed
DovahBrownies opened this issue Mar 22, 2021 · 3 comments
Closed

Cannot Import serverSideTranslations #1092

DovahBrownies opened this issue Mar 22, 2021 · 3 comments

Comments

@DovahBrownies
Copy link

Describe the bug

When I try to just import import { serverSideTranslations } from 'next-i18next/serverSideTranslations' into any page, I'm immediately hit with Module not found: Can't resolve 'fs'.

I've read around and I know that the function is only supposed to be invoked on the SS. But I can't even import it without a crash.

Any hints/help would be greatly appreciated.

Occurs in next-i18next version

"i18next": "^19.9.2",
"next": "^10.0.9",
"next-i18next": "^8.1.2",

Steps to reproduce

You must provide a reproducible repository, or copy/paste blocks of code which are sufficient to reproduce the bug.

import React from 'react'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'

const Page = () => {
   return (<p>hello</p>);
}

export default Page
@DovahBrownies DovahBrownies changed the title Cannot Even Import serverSideTranslations Cannot Import serverSideTranslations Mar 22, 2021
@isaachinman
Copy link
Contributor

Please provide a reproducible repo.

@annbeemsterboer
Copy link

annbeemsterboer commented Mar 23, 2021

Maybe some comments in this issue are of use to you #1040 (comment)

It seems like you are importing serverSideTranslations without using it. When you are not calling it (in getStaticProps or getServerSideProps), it will be included in the client-side bundle and gives you this error.

@DovahBrownies
Copy link
Author

Maybe some comments in this issue are of use to you #1040 (comment)

It seems like you are importing serverSideTranslations without using it. When you are not calling it (in getStaticProps or getServerSideProps), it will be included in the client-side bundle and gives you this error.

💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants