Skip to content

Conversation

@ItsOnlyBinary
Copy link
Contributor

this does increase the package size by ~80KB

closes #51

@ojamin ojamin requested a review from vith July 29, 2019 19:01
Copy link
Contributor

@vith vith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth splitting the locales into their own webpack chunks so we only download the ones we need?

try {
let lang = (_lang ? _lang : kiwi.i18n.language).split('-')
lang = lang[0] + '_' + lang[1].toUpperCase()
return require(/* webpackMode: "eager" */ '@uppy/locales/lib/' + lang)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be done with static import paths? Import paths that are determined at runtime can cause problems like webpack including unnecessary files in the bundle because it can't tell what's going to be needed, etc.

lang = lang[0] + '_' + lang[1].toUpperCase()
return require(/* webpackMode: "eager" */ '@uppy/locales/lib/' + lang)
} catch (e) {
return require(/* webpackMode: "eager" */ '@uppy/locales/lib/en_US')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably also use the import() syntax, since we're already using import statements instead of require everywhere else.

@ItsOnlyBinary
Copy link
Contributor Author

I could not get webpack to behave and load the chunks from the right place, always wanted to load the from webroot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate locales support

2 participants