i18next / i18next-browser-languageDetector

language detector used in browser environment for i18next
MIT License
873 stars 90 forks source link

v6.1.7 breaks create-react-app production build (and dev too) #267

Closed ddolcimascolo closed 2 years ago

ddolcimascolo commented 2 years ago

🐛 Bug Report

v6.1.7 breaks CRA production build with Module not found: Error: Default condition should be last one. Dev server is broken too with the same error

To Reproduce

npx create-react-app i18next-browser-languagedetector-6.1.7 cd i18next-browser-languagedetector-6.1.7/ npm i --save -E i18next-browser-languagedetector@6.1.7

Just import the module anywhere

--- a/src/index.js
+++ b/src/index.js
@@ -3,6 +3,7 @@ import ReactDOM from 'react-dom/client';
 import './index.css';
 import App from './App';
 import reportWebVitals from './reportWebVitals';
+import i from 'i18next-browser-languagedetector';

 const root = ReactDOM.createRoot(document.getElementById('root'));
 root.render(

npm run build

Expected behavior

Build succeeds

Your Environment

adrai commented 2 years ago

https://github.com/i18next/i18next-browser-languageDetector/issues/266

adrai commented 2 years ago

@gunters63 can you also check this please?

ddolcimascolo commented 2 years ago

Reproduction added, though it's really just importing the module :sweat:

gunters63 commented 2 years ago

The new types entry which fixed issue #266 should be moved to the start of its export entry. The default entry should always be last, as the error says.

adrai commented 2 years ago

v6.1.8 should fix this