Skip to content

Commit a9f5fbd

Browse files
committed
add sourceMapPathOverrides for all file extensions
1 parent 871ea3a commit a9f5fbd

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/debug-adapter/nativeScriptDebugAdapter.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,20 @@ export class NativeScriptDebugAdapter extends ChromeDebugAdapter {
237237
args.sourceMapPathOverrides['webpack:///*'] = `${fullAppDirPath}/*`;
238238
}
239239

240+
// Apply sourceMapPathOverrides for all file extions: "webpack://name_package/*.extensionFile": "${workspaceRoot}/*.extensionFile"
241+
const packageFilePath = join(args.webRoot, 'package.json');
242+
if (existsSync(packageFilePath)) {
243+
try {
244+
const packageFile = require(packageFilePath) as { name: string };
245+
const extensions = ["js", "ts", "vue", "svelte", "jsx", "tsx"];
246+
extensions.forEach(extension => {
247+
args.sourceMapPathOverrides[`webpack://${packageFile.name}/*.${extension}`] = `${args.webRoot}/*.${extension}`;
248+
})
249+
} catch (err) {
250+
logger.warn(`Error when trying to require package.json file from path '${packageFilePath}'. Error is: ${err}`);
251+
}
252+
}
240253
const webpackConfigFile = join(args.webRoot, 'webpack.config.js');
241-
242254
if (existsSync(webpackConfigFile)) {
243255
try {
244256
const webpackConfig = require(webpackConfigFile);

0 commit comments

Comments
 (0)