Next.js Discord

Discord Forum

next.config.cjs

Answered
Jason Fisher posted this in #help-forum
Open in Discord
Please can someone help with this config format. how to use transpilePackages option for example with @patternfly/react-styles?
Answered by Jason Fisher
I got the next.config.mjs with transpilePackages working, I was able to add the i18n config directly there and no need for including next-i18next.config.cjs
View full answer

10 Replies

@Jason Fisher Please can someone help with this config format. how to use transpilePackages option for example with @patternfly/react-styles?
1. Does next.config.cjs even work? I have only heard of next.config.js and next.config.mjs. The .js variant follows cjs while the .mjs variant follows esm.
2. What have you tried?
@joulev I only got the mjs to work with transpilePackages and patternfly
the js, and cjs I dont know syntax
the cjs only required for using this localization library "next-i18next"
@Jason Fisher <@484037068239142956> I only got the mjs to work with transpilePackages and patternfly
Yep so what’s have you tried? What’s a working code you already have? What’s a not working code you already have?
@joulev Yep so what’s have you tried? What’s a working code you already have? What’s a not working code you already have?
I got the next.config.mjs with transpilePackages working, I was able to add the i18n config directly there and no need for including next-i18next.config.cjs
Answer
@Jason Fisher the cjs only required for using this localization library "next-i18next"
Crested Myna
can you link to docs stating this?
@Crested Myna can you link to docs stating this?
Note example here https://github.com/i18next/next-i18next/blob/master/examples/simple/next-i18next.config.js
most import config is the i18n section. that can be placed directly in next.config.(mjs|js)
Trace issues mentioned here https://github.com/i18next/next-i18next/issues/2074
note this mentioned as possible fix - set ENV Variable I18NEXT_DEFAULT_CONFIG_PATH=./next-i18next.config.cjs