fix(build): Fix sourcemaps (#6352)

Get sourcemaps working again.

- The change in tsconfig.json is sufficient to get functional,
  per-.ts-file sourcemaps in build/src/** that work in
  uncompiled mode (i.e. in the playground / tests).
- No further changes are required for these to be ingested by
  gulp + Closure Compiler; the resulting files -
  build/*_compressed.js.map - now point at files in
  core/, blocks/, etc.  This works correctly when packaged and
  also when doing local testing in compiled mode of the checked-in
  build products (i.e., after they are copied to the repository
  root.)
- In order to get sourcemaps to work for local testing in
  compiled mode of the build products directly from build/,
  buildCompile now creates symlinks from build/ to core/,
  blocks/ and generators/.
This commit is contained in:
Christopher Allen
2022-08-17 17:05:38 +01:00
committed by GitHub
parent e9920a54e0
commit e10bf99936
2 changed files with 11 additions and 1 deletions

View File

@@ -630,6 +630,15 @@ function buildCompiled() {
// option to Closure Compiler; instead feed them as input via gulp.src.
};
// Symlink source dirs from build dir so that sourcemaps work in
// compiled-mode testing.
for (const src of ['core', 'blocks', 'generators']) {
const target = `${BUILD_DIR}/${src}`
if (!fs.existsSync(target)) {
fs.symlinkSync(`../${src}`, target);
}
}
// Fire up compilation pipline.
return gulp.src(chunkOptions.js, {base: './'})
.pipe(stripApacheLicense())