Skip to content

Commit

Permalink
fix(build): Fix sourcemaps (#6352)
Browse files Browse the repository at this point in the history
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/.
  • Loading branch information
cpcallen committed Aug 17, 2022
1 parent e9920a5 commit e10bf99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions scripts/gulpfiles/build_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
// normally they are ignored as source files
"allowJs": true,

// Generate d.ts files
// Generate d.ts files and sourcemaps.
"declaration": true,
"sourceMap": true,

"module": "ES2015",
"moduleResolution": "node",
Expand Down

0 comments on commit e10bf99

Please sign in to comment.