i18next: Typescript import doesn't work
import i18next from 'i18next'
import { enLocales } from './locales/en'
import { ruLocales } from './locales/ru'
console.log(i18next) // undefined
i18next.init({
debug: true,
resources: { en: enLocales, ru: ruLocales }
})
i18next_1.default.init({
^
TypeError: Cannot read property 'init' of undefined
tsconfig
{
"compilerOptions": {
"lib": [
"esnext",
"dom"
],
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017"
},
"compileOnSave": true,
"include": [
"src"
]
}
I can not use esModuleInterop, because many other libraries fall back
_Originally posted by @polRk in https://github.com/i18next/i18next/issues/1177#issuecomment-504989651_
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 19 (1 by maintainers)
Simple workarround for those who cannot use esModuleInterop
@polRk I think you should have some consideration for open source maintainers and learn that you need to contribute fixes for your own problems.
I volunteer to help with this project because I use it. It seems you are using it and have a problem that you want fixed, therefore I am willing to guide you in solving it.
TL;DR I am not responsible for fixing problems you have with this library, you are, and I am willing to help you.
I think you should correct this mistake
@tmtron absolutely agree with you, issue have to be reopen, workaround is actually workaround and temporary solution.
require
is weird in TypeScript, while setting esModuleInterop breaks even hello world projects