build: expose locales as package export for ES module resolution (#43431)

As part of v13, all APF packages use the `exports` field which defines
the public entry-points/mappings for a package. so-called package exports.

The `ng_package` rule creates all the necessary mappings/sub-path exports
for the entry-points of `@angular/common`. Though, since the locale files are
generated separately and are not an actual entry-point, we need to expose these
files publicly so that they can be imported/resolved by consumers.

PR Close #43431
This commit is contained in:
Paul Gschwendtner
2021-09-23 12:37:57 +02:00
committed by Dylan Hunn
parent 4b142c4ead
commit c7d37f74cf
2 changed files with 10 additions and 0 deletions
@@ -114,6 +114,8 @@ describe('@angular/common ng_package', () => {
node: './fesm2015/upgrade.mjs',
default: './fesm2020/upgrade.mjs',
},
'./locales/global/*': {default: './locales/global/*.js'},
'./locales/*': {default: './locales/*.mjs'},
}
}));
});
+8
View File
@@ -11,6 +11,14 @@
"dependencies": {
"tslib": "^2.3.0"
},
"exports": {
"./locales/global/*": {
"default": "./locales/global/*.js"
},
"./locales/*": {
"default": "./locales/*.mjs"
}
},
"peerDependencies": {
"@angular/core": "0.0.0-PLACEHOLDER",
"rxjs": "^6.5.3 || ^7.0.0"