Duplicate core-js module in the app's prod bundle due to polyfilling
See original GitHub issueDescribe the bug
After upgrading next-i18next
from version 0.18.1, I’ve started seeing two copies of core-js
in my prod bundle. This may be related to the fact that it’s in next-i18next
’s dependencies
and is also because of @babel/polyfill
in .babelrc
(9c96479e).
Before / after:


The problem may be to do with the fact that core-js
is now used as both an es module and a commonjs one by webpack when the app is built.
Occurs in next-i18next version
0.20.0…0.25.0
Steps to reproduce
Run bundle analyzer for the Next.js app
OS (please complete the following information)
- Device: MBP 2017 15"
- Browser: N/A
Additional context
Perhaps, polyfilling should be removed from the library completely – doing it only once on the app level ensures that it’s not done twice and so there are no duplicate items in the final bundle. As a replacement, the README could advise on what an app developer should do to support older browsers. Some thoughts are here: https://github.com/isaachinman/next-i18next/issues/107
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
I agree. I think that polyfilling and determining what browsers to support should be made at the app-level.
Fixed with 4bf9d37. Hoping to release this at the same time as the
rollup
work so that there won’t be a lapse in ES5 support.