Skip to content

Commit

Permalink
[Bug Fix]: Updating webview CSP + webpack sourcemapping overrides (#423)
Browse files Browse the repository at this point in the history
* [Bug Fix]: Updating webview CSP + webpack sourcemapping overrides

* Updating more sourcemap override locations
  • Loading branch information
Michael Liao authored Jun 22, 2021
1 parent 8364258 commit 0cd076d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
10 changes: 7 additions & 3 deletions examples/sourcemaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Note: These are the mappings that are included by default out of the box, with e
"webpack:///./*": "${webRoot}/*",
"webpack:///*": "*",
"webpack:///src/*": "${webRoot}/*",

This comment has been minimized.

Copy link
@hdhdfjhd

hdhdfjhd Nov 27, 2022

rg34

"webpack://*": "${webRoot}/*",
"meteor://💻app/*": "${webRoot}/*"
}
```
Expand All @@ -26,15 +27,18 @@ See the following examples for each entry in the default mappings (`webRoot = /U
Example:
"webpack:///./~/querystring/index.js"
-> "/Users/me/project/node_modules/querystring/index.js"
"webpack:///./*": "${webRoot}/*"
"webpack:///./*": "${webRoot}/*"
Example:
"webpack:///./src/app.js" -> "/Users/me/project/src/app.js"
"webpack:///*": "*"
"webpack:///*": "*"
Example:
"webpack:///project/app.ts" -> "/project/app.ts"
"webpack:///src/*": "${webRoot}/*"
"webpack:///src/*": "${webRoot}/*"
Example:
"webpack:///src/app.js" -> "/Users/me/project/app.js"
"webpack://*": "${webRoot}/*"
Example:
"webpack://src/app.js" -> "/Users/me/project/src/app.js"
"meteor://💻app/*": "${webRoot}/*"
Example:
"meteor://💻app/main.ts"` -> `"/Users/me/project/main.ts"
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
"webpack:///src/*": "${webRoot}/*",
"webpack:///*": "*",
"webpack:///./~/*": "${webRoot}/node_modules/*",
"webpack://*": "${webRoot}/*",
"meteor://💻app/*": "${webRoot}/*"
}
},
Expand Down Expand Up @@ -335,6 +336,7 @@
"webpack:///src/*": "${webRoot}/*",
"webpack:///*": "*",
"webpack:///./~/*": "${webRoot}/node_modules/*",
"webpack://*": "${webRoot}/*",
"meteor://💻app/*": "${webRoot}/*"
}
},
Expand Down Expand Up @@ -417,6 +419,7 @@
"webpack:///src/*": "${webRoot}/*",
"webpack:///*": "*",
"webpack:///./~/*": "${webRoot}/node_modules/*",
"webpack://*": "${webRoot}/*",
"meteor://💻app/*": "${webRoot}/*"
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/devtoolsPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export class DevToolsPanel {
style-src 'self' 'unsafe-inline' ${this.panel.webview.cspSource};
script-src 'self' 'unsafe-eval' ${this.panel.webview.cspSource};
frame-src 'self' ${this.panel.webview.cspSource};
connect-src 'self' ${this.panel.webview.cspSource};
connect-src 'self' data: ${this.panel.webview.cspSource};
">
<meta name="referrer" content="no-referrer">
<link href="${stylesUri}" rel="stylesheet"/>
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const SETTINGS_DEFAULT_PATH_OVERRIDES: IStringDictionary<string> = {
'webpack:///./*': '${webRoot}/*',
'webpack:///./~/*': '${webRoot}/node_modules/*',
'webpack:///src/*': '${webRoot}/*',
'webpack://*': '${webRoot}/*',
};
export const SETTINGS_DEFAULT_WEB_ROOT = '${workspaceFolder}';
export const SETTINGS_DEFAULT_SOURCE_MAPS = true;
Expand Down
3 changes: 2 additions & 1 deletion test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,8 @@ describe("utils", () => {
"webpack:///./*": `${testPath}\\*`,
"webpack:///./~/*": `${testPath}\\node_modules\\*`,
"webpack:///*": "*",
"webpack:///src/*": `${testPath}\\*`
"webpack:///src/*": `${testPath}\\*`,
"webpack://*": `${testPath}\\*`
};

// Ensure the new values are returned
Expand Down

0 comments on commit 0cd076d

Please sign in to comment.