Skip to content

🎥 Make videos programmatically with React

retrieve bundle location from error

Jonny Burger60f353f5a02f
diff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.ts
index 70efb7d21f..5ab84faec7 100644
--- a/packages/bundler/src/webpack-config.ts
+++ b/packages/bundler/src/webpack-config.ts
@@ -7,6 +7,7 @@ import {jsonStringifyWithCircularReferences} from './stringify-with-circular-ref
import {getWebpackCacheName} from './webpack-cache';
import esbuild = require('esbuild');
+import {Internals} from 'remotion';
import type {Configuration} from 'webpack';
import {AllowOptionalDependenciesPlugin} from './optional-dependencies';
export type WebpackConfiguration = Configuration;
@@ -122,7 +123,7 @@ export const webpackConfig = ({
],
output: {
hashFunction: 'xxhash64',
- filename: 'bundle.js',
+ filename: Internals.bundleName,
devtoolModuleFilenameTemplate: '[resource-path]',
assetModuleFilename:
environment === 'development' ? '[path][name][ext]' : '[hash][ext]',
diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.ts
index d73f278087..331047c80f 100644
--- a/packages/core/src/internals.ts
+++ b/packages/core/src/internals.ts
@@ -135,6 +135,7 @@ export const Internals = {
ResolveCompositionConfig,
REMOTION_STUDIO_CONTAINER_ELEMENT,
AssetManager,
+ bundleName: 'bundle.js'
};
export type {
diff --git a/packages/renderer/src/browser/should-log-message.ts b/packages/renderer/src/browser/should-log-message.ts
index 89c97f4d45..d0b086f319 100644
--- a/packages/renderer/src/browser/should-log-message.ts
+++ b/packages/renderer/src/browser/should-log-message.ts
@@ -1,3 +1,6 @@
+import path from 'node:path';
+import {Internals} from 'remotion';
+
export const shouldLogBrowserMessage = (message: string) => {
// Not relevant for the user
if (message.startsWith('DevTools listening on')) {
@@ -102,3 +105,16 @@ export const parseChromeLogLocation = (
location: match[2],
};
};
+
+export const retrieveBundleFileFromLocation = (
+ location: ChromeLogLocation,
+ webpackBundle: string,
+ serverPort: number
+) => {
+ const isLocalSource = `http://localhost:${serverPort}/${Internals.bundleName}`;
+ if (location.location !== isLocalSource) {
+ return null;
+ }
+
+ return path.join(webpackBundle, Internals.bundleName);
+};