Skip to content

🎥 Make videos programmatically with React

good improvement

Jonny Burger83872bbcede5
diff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.ts
index faab2f43bd..7979ef3215 100644
--- a/packages/bundler/src/webpack-config.ts
+++ b/packages/bundler/src/webpack-config.ts
@@ -90,8 +90,7 @@ export const webpackConfig = ({
aggregateTimeout: 0,
ignored: ['**/.git/**', '**/node_modules/**'],
},
-
- devtool: 'inline-source-map',
+ devtool: 'cheap-module-source-map',
entry: [
// Fast Refresh must come first,
// because setup-environment imports ReactDOM.
diff --git a/packages/studio/src/components/Timeline/TimelineStack.tsx b/packages/studio/src/components/Timeline/TimelineStack.tsx
index b506d1fb31..b90b00dbe9 100644
--- a/packages/studio/src/components/Timeline/TimelineStack.tsx
+++ b/packages/studio/src/components/Timeline/TimelineStack.tsx
@@ -1,11 +1,7 @@
import {useCallback, useEffect, useState} from 'react';
-import type {SourceMapConsumer} from 'source-map';
+import {SourceMapConsumer} from 'source-map';
import type {OriginalPosition} from '../../error-overlay/react-overlay/utils/get-source-map';
-import {
- getOriginalPosition,
- getSourceMap,
-} from '../../error-overlay/react-overlay/utils/get-source-map';
-import {getFileContents} from '../../error-overlay/react-overlay/utils/unmapper';
+import {getOriginalPosition} from '../../error-overlay/react-overlay/utils/get-source-map';
import {VERY_LIGHT_TEXT} from '../../helpers/colors';
import {getLocationOfSequence} from '../../helpers/get-location-of-sequence';
import {openInEditor} from '../../helpers/open-in-editor';
@@ -36,16 +32,12 @@ export const TimelineStack: React.FC<{
const location = getLocationOfSequence(stack);
if (location) {
- getFileContents(location?.fileName as string)
- .then((fileContents) => {
- return getSourceMap(
- location.fileName as string,
- fileContents as string,
- );
- })
- .then((frame) => {
+ fetch('/bundle.js.map')
+ .then((res) => res.json())
+ .then((sourceMap) => {
+ const map = new SourceMapConsumer(sourceMap);
return getOriginalPosition(
- frame as SourceMapConsumer,
+ map,
location.lineNumber as number,
location.columnNumber as number,
);