Skip to content

Commit 3595445

Browse files
alan-agius4AndrewKushnir
authored andcommitted
build(migrations): skip source map generation (#58299)
Remove the usage of MagicString and the generation of intermediate sourcemaps, as sourcemaps are never included in the schematic bundles. Peparing source maps is a CPU / memory intensive and was causing OoO errors in rollup. PR Close #58299
1 parent 2bfc64d commit 3595445

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

packages/core/schematics/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,5 @@ rollup_bundle(
6464
"//packages/core/schematics/ng-generate/standalone-migration",
6565
"@npm//@rollup/plugin-commonjs",
6666
"@npm//@rollup/plugin-node-resolve",
67-
"@npm//magic-string",
6867
],
6968
)

packages/core/schematics/rollup.config.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88
const {nodeResolve} = require('@rollup/plugin-node-resolve');
99
const commonjs = require('@rollup/plugin-commonjs');
10-
const MagicString = require('magic-string');
1110

1211
/** Removed license banners from input files. */
1312
const stripBannerPlugin = {
@@ -19,15 +18,19 @@ const stripBannerPlugin = {
1918
}
2019

2120
const [bannerContent] = banner;
22-
const magicString = new MagicString(code);
2321
const pos = code.indexOf(bannerContent);
24-
magicString.remove(pos, pos + bannerContent.length).trimStart();
22+
if (pos !== -1) {
23+
const result = code.slice(0, pos) + code.slice(pos + bannerContent.length);
24+
25+
return {
26+
code: result.trimStart(),
27+
map: null,
28+
};
29+
}
2530

2631
return {
27-
code: magicString.toString(),
28-
map: magicString.generateMap({
29-
hires: true,
30-
}),
32+
code: code,
33+
map: null,
3134
};
3235
},
3336
};

0 commit comments

Comments
 (0)