Skip to content

🎥 Make videos programmatically with React

ignore webpack

Jonny Burger4606ec698bc2
diff --git a/packages/bundler/src/optional-dependencies.ts b/packages/bundler/src/optional-dependencies.ts
index 336b130075..9b52fd0698 100644
--- a/packages/bundler/src/optional-dependencies.ts
+++ b/packages/bundler/src/optional-dependencies.ts
@@ -9,6 +9,8 @@ const OPTIONAL_DEPENDENCIES = [
'react-native-reanimated/package.json',
];
+const SOURCE_MAP_IGNORE = ['path', 'fs'];
+
export class AllowOptionalDependenciesPlugin {
filter(error: Error) {
for (const dependency of OPTIONAL_DEPENDENCIES) {
@@ -17,6 +19,15 @@ export class AllowOptionalDependenciesPlugin {
}
}
+ for (const dependency of SOURCE_MAP_IGNORE) {
+ if (
+ error.message.includes(`Can't resolve '${dependency}'`) &&
+ error.message.includes('source-map')
+ ) {
+ return false;
+ }
+ }
+
return true;
}
diff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.ts
index c69f1b7aaa..888d3e2729 100644
--- a/packages/bundler/src/webpack-config.ts
+++ b/packages/bundler/src/webpack-config.ts
@@ -90,7 +90,9 @@ export const webpackConfig = ({
aggregateTimeout: 0,
ignored: ['**/.git/**', '**/node_modules/**'],
},
- devtool: 'source-map',
+ // Higher source map quality in development to power line numbers for stack traces
+ devtool:
+ environment === 'development' ? 'source-map' : '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 07d202bc7a..ce8f8076fb 100644
--- a/packages/studio/src/components/Timeline/TimelineStack.tsx
+++ b/packages/studio/src/components/Timeline/TimelineStack.tsx
@@ -2,9 +2,11 @@ import {useCallback, useEffect, useState} from 'react';
import {SourceMapConsumer} from 'source-map';
import type {OriginalPosition} from '../../error-overlay/react-overlay/utils/get-source-map';
import {getOriginalPosition} from '../../error-overlay/react-overlay/utils/get-source-map';
-import {VERY_LIGHT_TEXT} from '../../helpers/colors';
+import {LIGHT_TEXT, VERY_LIGHT_TEXT} from '../../helpers/colors';
import {getLocationOfSequence} from '../../helpers/get-location-of-sequence';
import {openInEditor} from '../../helpers/open-in-editor';
+import {Spacing} from '../layout';
+import {Spinner} from '../Spinner';
// TODO: Use local version
// @ts-expect-error
@@ -18,6 +20,8 @@ export const TimelineStack: React.FC<{
const [originalLocation, setOriginalLocation] =
useState<OriginalPosition | null>(null);
+ const [hovered, setHovered] = useState(false);
+
const onClick = useCallback(() => {
if (!originalLocation) {
return;
@@ -63,21 +67,36 @@ export const TimelineStack: React.FC<{
}
}, [stack]);
+ const onPointerEnter = useCallback(() => {
+ setHovered(true);
+ }, []);
+
+ const onPointerLeave = useCallback(() => {
+ setHovered(false);
+ }, []);
+
if (!originalLocation) {
return null;
}
return (
<div
+ onPointerEnter={onPointerEnter}
+ onPointerLeave={onPointerLeave}
onClick={onClick}
style={{
fontSize: 12,
- color: VERY_LIGHT_TEXT,
+ color: hovered ? LIGHT_TEXT : VERY_LIGHT_TEXT,
marginLeft: 10,
cursor: 'pointer',
+ display: 'flex',
+ flexDirection: 'row',
+ alignItems: 'center',
}}
>
{originalLocation.source}:{originalLocation.line}
+ <Spacing x={0.5} />
+ <Spinner duration={0.5} size={12} />
</div>
);
};