You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 22, 2024. It is now read-only.
We've had some users run into issues where the generated files we produce via the aggregated-translations pre-build tool don't work in IE as it uses ES6+ features not supported in that browser natively. In our webpack config, we run those files through babel, though people who are not using our webpack config may miss running these generated files through babel resulting in code that doesn't work in one of our supported browsers.
To help with this, I propose we add a format option to the aggregated-translations pre-build tool.
By default, format would be undefined and would result in the generated files using an ES5 format. Generated files would use var statements and functions instead of const statements and arrow functions. By making the default undefined, users wouldn't have to change anything in therir code to get a version of the generated file that will work in all browsers terra-ui supports.
By setting the format option to modern, we would generate a file that uses modern ES6+ features intended to be run through babel. I'm flexible on what name we use for value that enables this format, for now I went with modern.
Additional Context / Screenshots
This format option resolves an issue we saw recently. It also solves a compatibility issue we'd run into with trying to use aggregated-translations pre-build tool with create-react-app v2. CRA v2 prevents the use of require.ensure, which is what we use in our current generated files. When using the modern format, we would switch to use dynamic imports, which CRA v2 supports.
As we add this format option, we wouldn't need to add dynamic imports at the same time. We could enhance the modern format to use dynamic imports at a later date and just have the modern version generate files the same as we do currently with const and arrow functions.
The text was updated successfully, but these errors were encountered:
What are the pros and cons of offering two types of generation? If there value to proving a modern generated version instead of always providing a generated version that doesn't need to be pre-compiled with babel?
The value in providing an option for a modern generated version is support with create-react-app v2.
The value in providing an option for a non-modern version, one that use ES5, is that people can use it and not have to configure babel to transpile it.
Pros:
Support wider use-cases (untranspiled and transpiled)
Feature Request
Description
We've had some users run into issues where the generated files we produce via the aggregated-translations pre-build tool don't work in IE as it uses ES6+ features not supported in that browser natively. In our webpack config, we run those files through babel, though people who are not using our webpack config may miss running these generated files through babel resulting in code that doesn't work in one of our supported browsers.
To help with this, I propose we add a
format
option to the aggregated-translations pre-build tool.By default,
format
would beundefined
and would result in the generated files using anES5
format. Generated files would usevar
statements and functions instead ofconst
statements and arrow functions. By making the defaultundefined
, users wouldn't have to change anything in therir code to get a version of the generated file that will work in all browsers terra-ui supports.By setting the
format
option tomodern
, we would generate a file that uses modern ES6+ features intended to be run through babel. I'm flexible on what name we use for value that enables this format, for now I went withmodern
.Additional Context / Screenshots
This format option resolves an issue we saw recently. It also solves a compatibility issue we'd run into with trying to use aggregated-translations pre-build tool with create-react-app v2. CRA v2 prevents the use of
require.ensure
, which is what we use in our current generated files. When using themodern
format, we would switch to usedynamic imports
, which CRA v2 supports.As we add this
format
option, we wouldn't need to add dynamic imports at the same time. We could enhance themodern
format to use dynamic imports at a later date and just have themodern
version generate files the same as we do currently withconst
and arrow functions.The text was updated successfully, but these errors were encountered: