fix(common): workaround UMD/webpack limitation (#23271)
Fixes #23217 PR Close #23271
This commit is contained in:
parent
3e8eef6015
commit
5a298b1c5e
|
@ -24,6 +24,10 @@ describe('@angular/common ng_package', () => {
|
|||
expect(files.some(n => n.endsWith('.d.ts'))).toBe(true, `.d.ts files don't exist`);
|
||||
expect(files.some(n => n.endsWith('.js'))).toBe(true, `.js files don't exist`);
|
||||
});
|
||||
// regression test for https://github.com/angular/angular/issues/23217
|
||||
// Note, we don't have an e2e test that covers this
|
||||
it('doesn\'t pass require in a way that breaks webpack static analysis',
|
||||
() => { expect(shx.cat('locales/fr.js')).not.toContain('factory(require, exports)'); });
|
||||
});
|
||||
|
||||
it('should have right bundle files', () => {
|
||||
|
|
|
@ -13,5 +13,14 @@ ts_library(
|
|||
|
||||
npm_package(
|
||||
name = "package",
|
||||
replacements = {
|
||||
# Workaround for https://github.com/angular/angular/issues/23217
|
||||
# Webpack will detect that the UMD outputs from TypeScript pass the
|
||||
# `require` function into the module, and cannot accurately track
|
||||
# dependencies in case require was called.
|
||||
# We don't actually import anything in the locale code so we can
|
||||
# null out the require reference passed into the module.
|
||||
"factory\(require, exports\)": "factory(null, exports)",
|
||||
},
|
||||
deps = [":locales"],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue