fusionjs / fusion-cli

Migrated to https://github.com/fusionjs/fusionjs
MIT License
140 stars 37 forks source link

Add translation key instrumentation for dynamic imports #769

Open micburks opened 5 years ago

micburks commented 5 years ago

Annotate dynamic imports with the translation keys the chunk contains

Fixes issues with dynamically loading translations where routing isn't guaranteed to hit the origin the initial request was served from. This will allow looking up a translation by key instead of the id of the chunk that contains it.

Essentially I had to split the i18nManifest state into its DeferredState and the Map that it resolves to. This way, the server build can wait for the client build to finish (as before) by referencing the DeferredState and the instrumentation plugin can use the Map directly to lookup translation keys.

This is supplemented by PRs in fusion-react, fusion-plugin-i18n, and fusion-plugin-i18n-react.

micburks commented 5 years ago

PR title is invalid: First word must be imperative verb.

Instrument can be an imperative verb