test(ngcc): use "module" format property for ES5 bundles (#36089)
The format property for ES5 bundles should be "module" or "es5"/"esm5", but was "main" instead. The "main" property is appropriate for CommonJS and UMD bundles, not for ES5 bundles. PR Close #36089
This commit is contained in:
@ -33,6 +33,7 @@ export function compileIntoFlatEs5Package(pkgName: string, sources: PackageSourc
|
||||
compileIntoFlatPackage(pkgName, sources, {
|
||||
target: ts.ScriptTarget.ES5,
|
||||
module: ts.ModuleKind.ESNext,
|
||||
formatProperty: 'module',
|
||||
});
|
||||
}
|
||||
|
||||
@ -46,6 +47,11 @@ export interface FlatLayoutOptions {
|
||||
* The module kind to use in the compiled result.
|
||||
*/
|
||||
module: ts.ModuleKind;
|
||||
|
||||
/**
|
||||
* The name of the property in package.json that refers to the root source file.
|
||||
*/
|
||||
formatProperty: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +96,7 @@ function compileIntoFlatPackage(
|
||||
const pkgJson: unknown = {
|
||||
name: pkgName,
|
||||
version: '0.0.1',
|
||||
main: './index.js',
|
||||
[options.formatProperty]: './index.js',
|
||||
typings: './index.d.ts',
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user