Open
Conversation
vith
suggested changes
Jul 30, 2019
Contributor
vith
left a comment
There was a problem hiding this comment.
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) |
Contributor
There was a problem hiding this comment.
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') |
Contributor
There was a problem hiding this comment.
This should probably also use the import() syntax, since we're already using import statements instead of require everywhere else.
Contributor
Author
|
I could not get webpack to behave and load the chunks from the right place, always wanted to load the from webroot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this does increase the package size by ~80KB
closes #51