React-i18next: I think v10 is not outputting a dist folder that I can import in CRA+TS app

Created on 6 Feb 2019  路  8Comments  路  Source: i18next/react-i18next

Describe the bug

./src/containers/App/index.tsx
Module not found: Can't resolve 'react-i18next' in '/Users/mattscheurich/Dev/react-app/src/containers/App'

Occurs in react-i18next version
10.0.0

To Reproduce
Steps to reproduce the behavior:

  1. npm i react-i18next --save
  2. import { useTranslation } from "react-i18next"; in any file (note: I'm using CRA+TS)
  3. npm run start
  4. See error in bug description above

Expected behaviour
I'd expect it to import react-i18next!

I wonder if because I'm using CRA and don't want to eject react-scripts that I need to use ES5-compatible code. If there's no dist folder in the node_modules/react-i18next package that the package.json's main file refers to.

Screenshots
image

OS (please complete the following information):

  • Device: MBP Mid-2015 15"

Additional context
I noticed that v10 was released just this morning! 馃帀 Do I get to claim "first issue" for v10?

Most helpful comment

@SekibOmazic Imports should be just react-i18next. No need to use react-i18next/hooks in v10

All 8 comments

same error here. Just created a dummy project with npx create-react-app my-app2 --typescript, added i18next and react-i18next dependencies. Here is what I get (screenshots):
screenshot 2019-02-06 at 23 04 16

screenshot 2019-02-06 at 23 20 21

Libs:

"react-i18next": "^10.0.0",
"react": "^16.8.1",
"react-dom": "^16.8.1",
"i18next": "^14.0.1",

I've deleted and reinstalled, seems to be back.

It was really strange because I removed my node_modules folder twice and attempted to reinstall everything twice, and this time I just deleted the single folder and reinstalled.

@SekibOmazic Imports should be just react-i18next. No need to use react-i18next/hooks in v10

I can confirm that changing the imports from react-i18next/hooks to react-i18next works. I guess the hooks.js should be simply removed from the distribution as it broken and no longer needed.

@bikeshedder hooks.js will be removed in the next version - forgotten todo so.

@panjiesw Yes! Thanks for the hint!

Was this page helpful?
0 / 5 - 0 ratings