This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Use webpack alias to resolve the languages file#2730
Merged
Conversation
Hopefully this will end up simpler than having to figure out in riot-web what the relative path is from react-sdk's src/languageHandler.js to riot-web's webapp directory.
jryans
reviewed
Mar 1, 2019
| // LANGUAGES_FILE is a webpack compile-time define, see webpack config | ||
| const url = (typeof LANGUAGES_FILE === "string") ? require(LANGUAGES_FILE) : (i18nFolder + 'languages.json'); | ||
| // Webapp is a webpack resolve alias pointing to the output directory, see webpack config | ||
| const url = require('Webapp/i18n/languages.json'); |
Collaborator
There was a problem hiding this comment.
This means the SDK now depends on Riot's Webpack config, which seems unfortunate. Maybe we can wrap this in a try and fallback to the i18nFolder version for non-Webpack/non-Riot usage?
Member
Author
There was a problem hiding this comment.
Good point - this also makes the unit tests work without extra config
Collaborator
|
Overall, this approach does look simpler! My main concern is about the hard dependency on Riot's Webpack, which I think we need some kind of fallback for. |
So we're not completely dependent on the alias being set
jryans
approved these changes
Mar 1, 2019
Collaborator
jryans
left a comment
There was a problem hiding this comment.
Looks good to me, assuming CI agrees! Seems easier to work with now.
(Thanks for indulging my naming nit... 😁)
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Hopefully this will end up simpler than having to figure out in riot-web what the relative path is from react-sdk's src/languageHandler.js to riot-web's webapp directory.
Requires element-hq/element-web#9014