Use source maps to get readable stack traces in production

Using the 'source-map' option does blow up the package size quite a bit, but I couldn't find another option that was doing the trick.
Fixes #5887
This commit is contained in:
Jason Fields 2021-02-07 17:40:31 -05:00
parent c76a63122a
commit 666ea2fa34
7 changed files with 19 additions and 8 deletions

View File

@ -4,7 +4,6 @@
.vscode-test/**
**/*.ts
**/*.map
*.yml
src/**

View File

@ -15,6 +15,8 @@ import './src/configuration/validators/remappingValidator';
import './src/configuration/validators/neovimValidator';
import './src/configuration/validators/vimrcValidator';
import { install as installSourceMapSupport } from 'source-map-support';
import * as vscode from 'vscode';
import { activate as activateFunc } from './extensionBase';
import { Globals } from './src/globals';
@ -26,6 +28,8 @@ export async function activate(context: vscode.ExtensionContext) {
// Set the storage path to be used by history files
Globals.extensionStoragePath = context.globalStoragePath;
installSourceMapSupport();
activateFunc(context);
}

View File

@ -1097,6 +1097,7 @@
"lodash": "^4.17.20",
"neovim": "4.9.0",
"path-browserify": "1.0.1",
"source-map-support": "0.5.19",
"untildify": "4.0.0",
"winston": "3.3.3",
"winston-console-for-electron": "0.0.6",
@ -1110,6 +1111,7 @@
"@types/mocha": "8.2.1",
"@types/node": "12.20.6",
"@types/sinon": "9.0.11",
"@types/source-map-support": "0.5.3",
"@types/vscode": "1.42.0",
"clean-webpack-plugin": "3.0.0",
"event-stream": "4.0.1",

View File

@ -43,11 +43,11 @@ class TaskQueue {
vscode.window
.showErrorMessage(e.message, reportButton)
.then((picked: string | undefined) => {
let body = `**To Reproduce**\nSteps to reproduce the behavior:\n\n1. Go to '...'\n2. Click on '....'\n3. Scroll down to '....'\n4. See error\n\n**VSCodeVim version**: ${extensionVersion}`;
if (stack) {
body += `\n\n<details><summary>Stack trace</summary>\n\n\`\`\`\n${stack}\n\`\`\`\n\n</details>`;
}
if (picked === reportButton) {
let body = `**To Reproduce**\nSteps to reproduce the behavior:\n\n1. Go to '...'\n2. Click on '....'\n3. Scroll down to '....'\n4. See error\n\n**VSCodeVim version**: ${extensionVersion}`;
if (stack) {
body += `\n\n<details><summary>Stack trace</summary>\n\n\`\`\`\n${stack}\n\`\`\`\n\n</details>`;
}
vscode.commands.executeCommand(
'vscode.open',
vscode.Uri.parse(

View File

@ -70,7 +70,7 @@ const nodelessConfig = {
filename: 'extensionWeb.js',
libraryTarget: 'umd',
},
devtool: 'inline-source-map',
devtool: 'source-map',
externals: {
vscode: 'commonjs vscode', // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
},

View File

@ -4,7 +4,6 @@ const prod_configs = require('./webpack.config.js');
module.exports = [
merge.merge(prod_configs[0], {
mode: 'development',
devtool: 'inline-source-map',
optimization: {
minimize: false,
removeAvailableModules: false,

View File

@ -231,6 +231,13 @@
resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"
integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==
"@types/source-map-support@0.5.3":
version "0.5.3"
resolved "https://registry.yarnpkg.com/@types/source-map-support/-/source-map-support-0.5.3.tgz#acb6b3e499c20692552d16934c16162c84594e16"
integrity sha512-fvjMjVH8Rmokw2dWh1dkj90iX5R8FPjeZzjNH+6eFXReh0QnHFf1YBl3B0CF0RohIAA3SDRJsGeeUWKl6d7HqA==
dependencies:
source-map "^0.6.0"
"@types/tapable@*":
version "1.0.6"
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.6.tgz#a9ca4b70a18b270ccb2bc0aaafefd1d486b7ea74"
@ -5228,7 +5235,7 @@ source-map-resolve@^0.6.0:
atob "^2.1.2"
decode-uri-component "^0.2.0"
source-map-support@~0.5.12, source-map-support@~0.5.19:
source-map-support@0.5.19, source-map-support@~0.5.12, source-map-support@~0.5.19:
version "0.5.19"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==