fix(core): export a value for InjectFlags (#27279)
A recent commit (probably 2c7386c
) has changed the import graph of the
DI types in core, and somehow results in the ngc compiler deciding to
re-export core DI types from application factories which tangentially
use inject(). This is not really surprising; ngc's import graph can be
very unstable.
However, this results in a re-export of InjectFlags surviving JS
compilation. InjectFlags was a const enum, akin to an interface in TS,
with no runtime repesentation. This causes a warning to be emitted by
Webpack when it sees the re-export of InjectFlags.
This commit avoids the issue by removing 'const' from the declaration
of InjectFlags, causing it to have a runtime value. This is a temporary
fix. The real fix will be for ngc to no longer write exports of const
enums.
Testing strategy: manually verified. Due to the problem only manifesting
when recompiling after a change and then running Webpack, there is no
existing framework via which this could be easily tested with an
integration test. Additionally, the potential for this issue is gone in
Ivy, so this solution is only temporarily needed.
Fixes #27251.
PR Close #27279
This commit is contained in:
parent
78e3a4c97c
commit
23b06af940
|
@ -19,7 +19,9 @@ import {Inject, Optional, Self, SkipSelf} from './metadata';
|
|||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const enum InjectFlags {
|
||||
export enum InjectFlags {
|
||||
// TODO(alxhub): make this 'const' when ngc no longer writes exports of it into ngfactory files.
|
||||
|
||||
Default = 0b0000,
|
||||
|
||||
/**
|
||||
|
|
|
@ -86,6 +86,9 @@
|
|||
{
|
||||
"name": "INJECTOR_SIZE"
|
||||
},
|
||||
{
|
||||
"name": "InjectFlags"
|
||||
},
|
||||
{
|
||||
"name": "IterableChangeRecord_"
|
||||
},
|
||||
|
|
|
@ -176,6 +176,9 @@
|
|||
{
|
||||
"name": "Inject"
|
||||
},
|
||||
{
|
||||
"name": "InjectFlags"
|
||||
},
|
||||
{
|
||||
"name": "InjectionToken"
|
||||
},
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
{
|
||||
"name": "Inject"
|
||||
},
|
||||
{
|
||||
"name": "InjectFlags"
|
||||
},
|
||||
{
|
||||
"name": "InjectionToken"
|
||||
},
|
||||
|
|
|
@ -74,6 +74,9 @@
|
|||
{
|
||||
"name": "INJECTOR_SIZE"
|
||||
},
|
||||
{
|
||||
"name": "InjectFlags"
|
||||
},
|
||||
{
|
||||
"name": "IterableChangeRecord_"
|
||||
},
|
||||
|
|
|
@ -371,6 +371,9 @@
|
|||
{
|
||||
"name": "Inject"
|
||||
},
|
||||
{
|
||||
"name": "InjectFlags"
|
||||
},
|
||||
{
|
||||
"name": "InjectionToken"
|
||||
},
|
||||
|
|
|
@ -347,7 +347,7 @@ export interface InjectDecorator {
|
|||
new (token: any): Inject;
|
||||
}
|
||||
|
||||
export declare const enum InjectFlags {
|
||||
export declare enum InjectFlags {
|
||||
Default = 0,
|
||||
Host = 1,
|
||||
Self = 2,
|
||||
|
|
Loading…
Reference in New Issue