fnando / i18n-js

It's a small library to provide the I18n translations on the Javascript. It comes with Rails support.
MIT License
3.75k stars 519 forks source link

Bug: Unable to resolve make-plural #703

Closed galnoba closed 1 year ago

galnoba commented 1 year ago

Description

The bundler fails with the error: Unable to resolve "make-plural" from "node_modules\i18n-js\dist\import\Pluralization.js

How to reproduce

Add i18n-js to an expo project, run yarn build, then run npx expo start.

What do you expect

Never had issues with i18n-js when bundling

What happened instead

The bundler failed

image

TwistedMinda commented 1 year ago

@galnoba You need to add tell Metro to bundle .mjs files, for example with metro.config.js:

const { getDefaultConfig } = require('metro-config')

module.exports = (async () => {
  const {
    resolver: { assetExts, sourceExts }
  } = await getDefaultConfig()

  return {
    resolver: {
      sourceExts: [...sourceExts, 'mjs']
    },
    ...
  }
})()
fnando commented 1 year ago

Closing this, as it's a build pipeline configuration. I've updated the readme file to reflect this config: https://github.com/fnando/i18n/commit/d4a14ca41d815403ee331f0e63d9b41aa612cbbc