i18next / i18next-browser-languageDetector

language detector used in browser environment for i18next
MIT License
865 stars 88 forks source link

Big bundle size #254

Closed nicgirault closed 2 years ago

nicgirault commented 2 years ago

💥 Regression Report

After upgrading from 6.0.1 to 6.1.3, the bundle size of i18next-browser-languageDetector is huge.

image
adrai commented 2 years ago

how are you including it in your setup?

https://bundlephobia.com/package/i18next-browser-languagedetector@6.1.3

adrai commented 2 years ago

for example, here it looks like this:

image
nicgirault commented 2 years ago

I was wrong, the problem is already present in 6.0.1. I use create-react-app v5.

My tsconfig.json look like this:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react-jsx",
    "moduleResolution": "node",
    "rootDir": ".",
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "skipLibCheck": true,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": false,
    "downlevelIteration": true,
    "esModuleInterop": true,
    "strict": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "noFallthroughCasesInSwitch": true,
    "baseUrl": "src"
  },
  "exclude": [
    "node_modules"
  ],
  "include": ["src"]
}

and I import like this:

import LanguageDetector from 'i18next-browser-languagedetector'

Does it answer your question?

adrai commented 2 years ago

Can you create a reproducible example based on https://github.com/i18next/react-i18next/tree/master/example/react ?

adrai commented 2 years ago

I tried to reproduce it, but even with your tsconfig.json file, I'm not able: https://github.com/adrai/react-i18next-ts

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

chybisov commented 1 year ago

@adrai hey, I have the same issue

image

You can find a reproducible example here https://github.com/lifinance/widget/tree/main/packages/widget-playground

If I open this file from node_modules in Finder, it actually shows the correct size 🤔

image
adrai commented 1 year ago

sorry no idea 🤷‍♂️

chybisov commented 1 year ago

sorry no idea 🤷‍♂️

@adrai, can it be because of @babel/runtime mentioned in dependencies instead of devDependencies?

"dependencies": {
    "@babel/runtime": "^7.19.4"
  },
adrai commented 1 year ago

No, that dependency is used.... check your installed node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js file