-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): use babel-loader instead of ts-loader for web build builder
- 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
- Loading branch information
Showing
40 changed files
with
635 additions
and
567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
module.exports = require('../src/plugins/babel').getBabelWebpackConfig; | ||
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; |
57 changes: 57 additions & 0 deletions
57
packages/react/src/migrations/update-8-5-0/update-workspace-8-5-0.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Tree } from '@angular-devkit/schematics'; | ||
import { SchematicTestRunner } from '@angular-devkit/schematics/testing'; | ||
import { | ||
updateJsonInTree, | ||
readJsonInTree, | ||
updateWorkspaceInTree, | ||
readWorkspace, | ||
getWorkspacePath | ||
} from '@nrwl/workspace'; | ||
|
||
import * as path from 'path'; | ||
import { stripIndents } from '@angular-devkit/core/src/utils/literals'; | ||
|
||
describe('Update 8-5-0', () => { | ||
let tree: Tree; | ||
let schematicRunner: SchematicTestRunner; | ||
|
||
beforeEach(async () => { | ||
tree = Tree.empty(); | ||
schematicRunner = new SchematicTestRunner( | ||
'@nrwl/react', | ||
path.join(__dirname, '../../../migrations.json') | ||
); | ||
}); | ||
|
||
it(`should remove babel schematic defaults`, async () => { | ||
tree.create( | ||
'workspace.json', | ||
JSON.stringify({ | ||
schematics: { | ||
'@nrwl/react': { | ||
application: { | ||
babel: true | ||
} | ||
}, | ||
'@nrwl/react:application': { | ||
babel: true | ||
} | ||
} | ||
}) | ||
); | ||
|
||
tree = await schematicRunner | ||
.runSchematicAsync('update-workspace-8.5.0', {}, tree) | ||
.toPromise(); | ||
|
||
const config = readWorkspace(tree); | ||
expect(config).toEqual({ | ||
schematics: { | ||
'@nrwl/react': { | ||
application: {} | ||
}, | ||
'@nrwl/react:application': {} | ||
} | ||
}); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
packages/react/src/migrations/update-8-5-0/update-workspace-8-5-0.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Rule } from '@angular-devkit/schematics'; | ||
import { updateWorkspaceInTree } from '@nrwl/workspace'; | ||
|
||
export default function update(): Rule { | ||
return updateWorkspaceInTree(config => { | ||
const a = []; | ||
const b = []; | ||
Object.keys(config.schematics).forEach(name => { | ||
if (name === '@nrwl/react' && config.schematics[name].application) { | ||
a.push(config.schematics[name]); | ||
} | ||
if (name === '@nrwl/react:application') { | ||
b.push(config.schematics[name]); | ||
} | ||
}); | ||
a.forEach(x => { | ||
delete x.application.babel; | ||
}); | ||
b.forEach(x => { | ||
delete x.babel; | ||
}); | ||
return config; | ||
}); | ||
} |
Oops, something went wrong.