Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
build(migrations): skip source map generation
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.
  • Loading branch information
alan-agius4 authored and pkozlowski-opensource committed Oct 22, 2024
commit 8de8c85276f6c8dbc619ae1d4ee591450f961ac7
1 change: 0 additions & 1 deletion packages/core/schematics/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,5 @@ rollup_bundle(
"//packages/core/schematics/ng-generate/standalone-migration",
"@npm//@rollup/plugin-commonjs",
"@npm//@rollup/plugin-node-resolve",
"@npm//magic-string",
],
)
17 changes: 10 additions & 7 deletions packages/core/schematics/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
const {nodeResolve} = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const MagicString = require('magic-string');

/** Removed license banners from input files. */
const stripBannerPlugin = {
Expand All @@ -19,15 +18,19 @@ const stripBannerPlugin = {
}

const [bannerContent] = banner;
const magicString = new MagicString(code);
const pos = code.indexOf(bannerContent);
magicString.remove(pos, pos + bannerContent.length).trimStart();
if (pos !== -1) {
const result = code.slice(0, pos) + code.slice(pos + bannerContent.length);

return {
code: result.trimStart(),
map: null,
};
}

return {
code: magicString.toString(),
map: magicString.generateMap({
hires: true,
}),
Comment thread
pkozlowski-opensource marked this conversation as resolved.
Outdated
code: code,
map: null,
};
},
};
Expand Down