Skip to content

Commit c2b32d5

Browse files
committed
Last step! Remove the webpack scheme from the source maps
1 parent 842ac8f commit c2b32d5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

webpack.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ async function getWebviewConfig(mode, env, entry) {
7474
output: {
7575
filename: '[name].js',
7676
path: path.resolve(__dirname, 'dist'),
77+
// Use absolute paths (file:///) in source maps instead of the default webpack:// scheme
78+
devtoolModuleFilenameTemplate: info => 'file:///' + info.absoluteResourcePath.replace(/\\/g, '/'),
79+
devtoolFallbackModuleFilenameTemplate: 'file:///[absolute-resource-path]'
7780
},
7881
optimization: {
7982
minimizer: [
@@ -233,7 +236,7 @@ async function getExtensionConfig(target, mode, env) {
233236
// Add main test runner
234237
entry['test/index'] = './src/test/index.ts';
235238

236-
// Add individual test files as separate entry points
239+
// Add individual test files as separate entry points
237240
const testFiles = glob.sync('src/test/**/*.test.ts', { cwd: __dirname });
238241
testFiles.forEach(testFile => {
239242
// Convert src/test/github/utils.test.ts -> test/github/utils.test
@@ -260,6 +263,9 @@ async function getExtensionConfig(target, mode, env) {
260263
libraryTarget: 'commonjs2',
261264
filename: '[name].js',
262265
chunkFilename: 'feature-[name].js',
266+
// Use absolute paths (file:///) in source maps for easier debugging of tests & sources
267+
devtoolModuleFilenameTemplate: info => 'file:///' + info.absoluteResourcePath.replace(/\\/g, '/'),
268+
devtoolFallbackModuleFilenameTemplate: 'file:///[absolute-resource-path]',
263269
},
264270
optimization: {
265271
minimizer: [

0 commit comments

Comments
 (0)