078b0be4dc
Although this code has been part of Angular 9.x I only noticed this error when upgrading to Angular 9.1.x because historically the source locale data was not injected when localizing, but as of angular/angular-cli#16394 (9.1.0) it is now included. This tipped me off that my other bundles were not being built properly, and this change allows me to build a valid ES5 bundle (I have also added a verification step to my build pipeline to alert me if this error appears again in any of my bundles). I found the `locales/global/*.js` file paths being referenced by the `I18nOptions` in @angular-devkit/build-angular/src/utils/i18n-options.ts, and following that it looks like it is actually loaded and used in @angular-devkit/build-angular/src/utils/process-bundle.ts. I saw the function `terserMangle` does appear that it is likely aware of the build being ES5, but I'm not sure why this is not producing a valid ES5 bundle. This change updates `tools/gulp-tasks/cldr/extract.js` to produce ES5 compliant `locales/global/*.js` and that fixes my issue. However, I am not sure if @angular-devkit/build-angular should be modified to produce a valid ES5 bundle instead or if the files could be TypeScript rather than JavaScript files. A test that a valid ES5 bundle is produced would be helpful, and I hope this is reproducible and not some issue with my config. PR Close #36342 |
||
---|---|---|
.. | ||
cldr | ||
README.md | ||
changelog-zonejs.js | ||
changelog.js | ||
cldr.js | ||
format.js | ||
platform-script-path.js | ||
source-map-test.js |
README.md
Gulp Tasks folder
This folder contains one file for each task (or group of related tasks) for the project's gulpfile. The dependencies between the tasks is kept in the gulpfile.
Task File Structure
Each task is defined by a factory function that accepts gulp
as a parameter.
Each file exports either one factory or an object of factories.
E.g. The build.js
file contains only one task:
module.exports = (gulp) => (done) => {
...
};
E.g. The format.js
file contains two tasks:
module.exports = {
// Check source code for formatting errors (clang-format)
enforce: (gulp) => () => {
...
},
// Format the source code with clang-format (see .clang-format)
format: (gulp) => () => {
...
}
};
Loading Tasks
The tasks are loaded in the gulp file, by requiring them. There is a helper called loadTask(fileName, taskName)
will do this for us, where the taskName
is optional if the file only exports one task.
E.g. Loading the task that will run the build, from a task file that contains only one task.
gulp.task('build.sh', loadTask('build'));
E.g. Loading the task that will enforce formatting, from a task file that contains more than one task:
gulp.task('format:enforce', loadTask('format', 'enforce'));
E.g. Loading a task that has dependencies:
gulp.task('lint', ['format:enforce'], loadTask('lint'));