Skip to content

🎥 Make videos programmatically with React

handle case where there is no source map

Jonny Burger05c5f3fe377d
diff --git a/packages/bundler/src/error-overlay/react-overlay/utils/get-source-map.ts b/packages/bundler/src/error-overlay/react-overlay/utils/get-source-map.ts
index e78a4782a6..6fa9bcc4d5 100644
--- a/packages/bundler/src/error-overlay/react-overlay/utils/get-source-map.ts
+++ b/packages/bundler/src/error-overlay/react-overlay/utils/get-source-map.ts
@@ -45,8 +45,8 @@ export class SourceMap {
return {line: l as number, column: c as number, source: s as string};
}
- getSource(sourceName: string): string {
- return this.__source_map.sourceContentFor(sourceName) as string;
+ getSource(sourceName: string): string | null {
+ return this.__source_map.sourceContentFor(sourceName);
}
}
diff --git a/packages/bundler/src/error-overlay/react-overlay/utils/unmapper.ts b/packages/bundler/src/error-overlay/react-overlay/utils/unmapper.ts
index 67905592c2..7f0e7f36a8 100644
--- a/packages/bundler/src/error-overlay/react-overlay/utils/unmapper.ts
+++ b/packages/bundler/src/error-overlay/react-overlay/utils/unmapper.ts
@@ -60,11 +60,10 @@ export const unmap = async (
);
const {functionName} = frame.frame;
- const scriptCode = getLinesAround(
- pos.line,
- contextLines,
- map.getSource(pos.source).split('\n')
- );
+ const hasSource = map.getSource(pos.source);
+ const scriptCode = hasSource
+ ? getLinesAround(pos.line, contextLines, hasSource.split('\n'))
+ : null;
return {
originalColumnNumber: pos.column,