Skip to content

Commit

Permalink
filter mainFields for angular16
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf authored and valentinpalkovic committed Apr 24, 2023
1 parent 74ba275 commit e92c0ef
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,23 @@ export const webpack = async (webpackConfig: Configuration, options: PresetOptio
return webpackConfig;
}

let extraMainFields: string[] = [];

if (angularOptions.enableNgcc !== false && !isAngular16OrNewer) {
// TODO: Drop if Angular 14 and 15 are not supported anymore
runNgcc();
extraMainFields = ['es2015_ivy_ngcc', 'module_ivy_ngcc', 'main_ivy_ngcc'];
}

if (!isAngular16OrNewer) {
extraMainFields.push('es2015');
}

return {
...webpackConfig,
resolve: {
...webpackConfig.resolve,
mainFields: [
'es2015_ivy_ngcc',
'module_ivy_ngcc',
'main_ivy_ngcc',
'es2015',
'browser',
'module',
'main',
],
mainFields: [...extraMainFields, 'browser', 'module', 'main'],
},
};
};

0 comments on commit e92c0ef

Please sign in to comment.