i18n: Bug: JS v4.4.1 breaks with webpack, and changing `resolve.conditionNames` configuration is not expected

Incoming reproducible test case

https://github.com/diowa/icare/actions/runs/7872274448/job/21477141544?pr=1650#step:10:43

Relevant change: https://github.com/diowa/icare/pull/1650/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R32

[!NOTE]
Sorry about the not-so-reduced test case. There are two JS errors, the second (google maps key) is unrelated. We are interested in the first one for this issue

Description

ERROR
i18n_js__WEBPACK_IMPORTED_MODULE_0__.I18n is not a constructor
TypeError: i18n_js__WEBPACK_IMPORTED_MODULE_0__.I18n is not a constructor

How to reproduce

import { I18n } from 'i18n-js'
import translations from 'src/locales/translations.json'

const i18n = new I18n(translations)

What do you expect

Since this is a minor release, I was expected the same behaviour as before. Or at least an entry in the changelog and updated documentation

What happened instead

Breaks JavaScript functionality

Software:

  • Gem version: 4.2.3
  • Ruby version: 3.3.0

Full backtrace

  1) Application protects pages from guest users
     Failure/Error: raise error_messages if severe_errors.any?
     
     RuntimeError:
       There were 2 JavaScript errors:
     
       http://127.0.0.1:54260/packs-test/js/application.js 217:13 Uncaught TypeError: i18n_js__WEBPACK_IMPORTED_MODULE_0__.I18n is not a constructor

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Reactions: 2
  • Comments: 25 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Just released v4.4.2.

@short-dsb thanks for reporting it back. I’m going to release 4.4.2 then.

Same on React-Native 0.72, it won’t compile.

Thanks for the quick fix, @fnando. 🙂

Same 4.4.2-alpha.0 works as expected. Thank you for you time put into fixing this issue @fnando.