Respond to Rollup warning for i18n.mjs
See original GitHub issueWhat
This notice, which we think is coming from Rollup, currently appears in the test output:
Entry module “src/govuk/i18n.mjs” is implicitly using “default” export mode, which means for CommonJS output that its default export is assigned to “module.exports”. For many tools, such CommonJS output will not be interchangeable with the original ES module. If this is intended, explicitly set “output.exports” to either “auto” or “default”, otherwise you might want to consider changing the signature of “src/govuk/i18n.mjs” to use named exports only.
Understand whether there are implications for consumers of GOV.UK Frontend and whether we need to make any changes.
If we don’t need to make any changes, see if there’s a way to silence the warning.
Why
src/govuk/i18n.mjs
is a new file which has not yet been included in a release of GOV.UK Frontend.
We want to make sure that the way that we’ve written i18n.mjs
will not impact consumers of GOV.UK Frontend once the next release has gone out.
Who needs to work on this
Developers
Who needs to review this
Developers
Done when
- We understand the implications of the warning
- We’ve made any changes required before shipping the next release
- The warning no longer appears in the test output (unless it’s not possible to silence it)
Issue Analytics
- State:
- Created a year ago
- Comments:11 (11 by maintainers)
Top GitHub Comments
Maybe using a named export would make the warning disappear, as it seems to complain about the export being a default one. If that’s the case, that might be a cheap, quick fix for the warning 😄
I don’t think there’s anything stopping I18n from being public.
It’s been built around the needs of our existing components and is definitely not the most fully-featured i18n script around (no genders, contextual grammar, etc.), so external users may run into the limitations of it harder than we have, but it does work (🤞).