1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 07:16:36 +01:00

Use inline source maps in development (#6754)

There is currently a bug in chrome that prevents reading source maps
from a local file [0]. This was preventing Chrome DevTools from using
our JavaScript source maps, where were saved as `.map` files. To work
around this problem the source maps are now generated inline, which
seems to work fine.

The only other browser I tested this with was Firefox, which works both
before and after this change.

[0]: https://bugs.chromium.org/p/chromium/issues/detail?id=931675
This commit is contained in:
Mark Stacey 2019-06-26 14:05:57 -03:00 committed by GitHub
parent 76e7c3bd1f
commit 3f8c9126fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,7 +347,7 @@ function createTasksForBuildJsExtension ({ buildJsFiles, taskPrefix, devMode, te
const destinations = browserPlatforms.map(platform => `./dist/${platform}`)
bundleTaskOpts = Object.assign({
buildSourceMaps: true,
sourceMapDir: devMode ? './' : '../sourcemaps',
sourceMapDir: '../sourcemaps',
minifyBuild: !devMode,
buildWithFullPaths: devMode,
watch: devMode,
@ -604,10 +604,17 @@ function bundleTask (opts) {
}))
}
// Finalize Source Maps (writes .map file)
// Finalize Source Maps
if (opts.buildSourceMaps) {
buildStream = buildStream
.pipe(sourcemaps.write(opts.sourceMapDir))
if (opts.devMode) {
// Use inline source maps for development due to Chrome DevTools bug
// https://bugs.chromium.org/p/chromium/issues/detail?id=931675
buildStream = buildStream
.pipe(sourcemaps.write())
} else {
buildStream = buildStream
.pipe(sourcemaps.write(opts.sourceMapDir))
}
}
// write completed bundles