- removes the `differentialLoading` build option - differential loading is always enabled for prod builds BEFORE (without ESM): Benchmark #1: nx build demo --prod Time (mean ± σ): 13.834 s ± 1.731 s [User: 11.817 s, System: 1.352 s] Range (min … max): 11.947 s … 16.015 s 10 runs AFTER (with ESM): Benchmark #1: nx build demo --prod Time (mean ± σ): 18.711 s ± 1.310 s [User: 12.172 s, System: 1.394 s] Range (min … max): 17.232 s … 20.770 s 10 runs
24 lines
534 B
TypeScript
24 lines
534 B
TypeScript
import { Configuration } from 'webpack';
|
|
|
|
// Adds react preset for JSX support
|
|
function getBabelWebpackConfig(config: Configuration) {
|
|
const babelRuleOptions = config.module.rules.find(
|
|
r => r.loader === 'babel-loader'
|
|
).options as any;
|
|
|
|
const idx = babelRuleOptions.presets.findIndex(
|
|
p => Array.isArray(p) && p[0] === '@babel/preset-env'
|
|
);
|
|
|
|
babelRuleOptions.presets.splice(idx, 0, [
|
|
'@babel/preset-react',
|
|
{
|
|
useBuiltIns: true
|
|
}
|
|
]);
|
|
|
|
return config;
|
|
}
|
|
|
|
module.exports = getBabelWebpackConfig;
|