It seems this can possible in es5 and imagine NextI18Next got some functions in it:
module.exports = new NextI18Next({
otherLanguages: ['ko'],
defaultLanguage: 'en',
ns: ['translations'],
defaultNS: 'translations',
localePath: path.resolve('../../public/locales'),
})
///////////
import { appWithTranslation, ... } from "..."
appWithTranslation()
So you can exports all class members simply just use module.exports
, but
in es6 >= version
You should use like this:
const i18n = new NextI18Next({
otherLanguages: ['ko'],
defaultLanguage: 'en',
ns: ['translations'],
defaultNS: 'translations',
localePath: path.resolve('../../public/locales'),
})
export default i18n
export const appWithTranslation = i18n.appWithTranslation
export const useTranslation = i18n.useTranslation
// ...
/////////
import { appWithTranslation, ... } from "..."
appWithTranslation()
It seems you can't exports all class members in es5 does.
Is there are ways to exports all class members simply like es5?