If code in build/l10n/l20n.js is only run and required from xpcshell, we should be able to use the es6 version of l20n and benefit from the babel bundler that Zibi wrote.
Note, that since we are using pure es6, node is catching up really quick and they're currently one feature away from supporting our es6 code. So even if in the future we will want to use node for this, there's a very high chance that it'll just work out of the box, and for us ability to remove the transpiler is a huge improvement.
Ricky, I'd like to replace build/l10n/l20n with the same code written in es6. Currently it's transpiled to es5 using babel+webpack. Perhaps that's not needed? What is the current plan regarding running the Gaia build system in node? The localization logic makes use of XPCShell features like processEvents and DOMParser anyways which makes me think that it would be safe to use the es6 version. It would make working with some corner-cases easier and would also make the diffs prettier. What do you think?
Created attachment 8669916 [details] [review] Pull request
Assignee: nobody → stas
Status: NEW → ASSIGNED
Attachment #8669916 - Flags: review?(gandalf)
Comment on attachment 8669916 [details] [review] Pull request yes pls! Not only the code in this file: https://github.com/mozilla-b2g/gaia/blob/master/build/l10n/l20n.js makes no sense, but also its history is unreadable.
Attachment #8669916 - Flags: review?(gandalf) → review+
Hey, build system is going to continue node refactoring plan and adopt latest node 4.x for building gaia. for integration part, we'll introduce nvm or n or node version switch in order to fallback to 0.12.x for running marionette. So yes, we're working on node migration and want to get rid of xpcshell stuffs (b2g_sdk) in the future. I think we should use babel + webpack solution until node 4.x fully support es6.
OK, I see, thanks Ricky. Here's an alternative proposal: let's use babel to transpile our bundle down to es5, and let's drop webpack which mangles and reorders parts of the file.
Bug 1211938 removes webpack. build/l10n/l20n.js will be now built with our babel bundler and transpiled to es5. I'll land the file in Gaia on the next update of l20n.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1211938
You need to log in before you can comment on or make changes to this bug.