diff --git a/code/builders/builder-manager/templates/template.ejs b/code/builders/builder-manager/templates/template.ejs
index 51dc22697c87..7961f4ae4f7c 100644
--- a/code/builders/builder-manager/templates/template.ejs
+++ b/code/builders/builder-manager/templates/template.ejs
@@ -57,11 +57,13 @@
<% } %>
diff --git a/code/ui/manager/package.json b/code/ui/manager/package.json
index 8dce8a776dd0..f355fa6b976b 100644
--- a/code/ui/manager/package.json
+++ b/code/ui/manager/package.json
@@ -95,7 +95,8 @@
"pre": "./scripts/generate-exports-file.ts",
"browserEntries": [
"./src/index.tsx",
- "./src/runtime.ts"
+ "./src/runtime.ts",
+ "./src/globals-runtime.ts"
],
"nodeEntries": [
"./src/globals.ts"
diff --git a/code/ui/manager/src/globals-runtime.ts b/code/ui/manager/src/globals-runtime.ts
new file mode 100644
index 000000000000..b701c059b7e3
--- /dev/null
+++ b/code/ui/manager/src/globals-runtime.ts
@@ -0,0 +1,28 @@
+import { global } from '@storybook/global';
+
+import { TELEMETRY_ERROR } from '@storybook/core-events';
+
+import { values } from './globals/runtime';
+import { Keys } from './globals/types';
+import { prepareForTelemetry, shouldSkipError } from './utils/prepareForTelemetry';
+
+// Apply all the globals
+Object.keys(Keys).forEach((key: keyof typeof Keys) => {
+ global[Keys[key]] = values[key];
+});
+
+global.sendTelemetryError = (error) => {
+ if (!shouldSkipError(error)) {
+ const channel = global.__STORYBOOK_ADDONS_CHANNEL__;
+ channel.emit(TELEMETRY_ERROR, prepareForTelemetry(error));
+ }
+};
+
+// handle all uncaught errors at the root of the application and log to telemetry
+global.addEventListener('error', (args) => {
+ const error = args.error || args;
+ global.sendTelemetryError(error);
+});
+global.addEventListener('unhandledrejection', ({ reason }) => {
+ global.sendTelemetryError(reason);
+});
diff --git a/code/ui/manager/src/runtime.ts b/code/ui/manager/src/runtime.ts
index efa348ac47e0..861fc3b88fcb 100644
--- a/code/ui/manager/src/runtime.ts
+++ b/code/ui/manager/src/runtime.ts
@@ -5,14 +5,10 @@ import type { AddonStore } from '@storybook/manager-api';
import { addons } from '@storybook/manager-api';
import type { Addon_Types, Addon_Config } from '@storybook/types';
import { createBrowserChannel } from '@storybook/channels';
-import { CHANNEL_CREATED, TELEMETRY_ERROR } from '@storybook/core-events';
+import { CHANNEL_CREATED } from '@storybook/core-events';
import Provider from './provider';
import { renderStorybookUI } from './index';
-import { values } from './globals/runtime';
-import { Keys } from './globals/types';
-import { prepareForTelemetry, shouldSkipError } from './utils/prepareForTelemetry';
-
const { FEATURES, CONFIG_TYPE } = global;
class ReactProvider extends Provider {
@@ -57,27 +53,6 @@ class ReactProvider extends Provider {
}
}
-// Apply all the globals
-Object.keys(Keys).forEach((key: keyof typeof Keys) => {
- global[Keys[key]] = values[key];
-});
-
-global.sendTelemetryError = (error) => {
- if (!shouldSkipError(error)) {
- const channel = global.__STORYBOOK_ADDONS_CHANNEL__;
- channel.emit(TELEMETRY_ERROR, prepareForTelemetry(error));
- }
-};
-
-// handle all uncaught errors at the root of the application and log to telemetry
-global.addEventListener('error', (args) => {
- const error = args.error || args;
- global.sendTelemetryError(error);
-});
-global.addEventListener('unhandledrejection', ({ reason }) => {
- global.sendTelemetryError(reason);
-});
-
const { document } = global;
const rootEl = document.getElementById('root');
renderStorybookUI(rootEl, new ReactProvider());
diff --git a/code/yarn.lock b/code/yarn.lock
index b35eec66debd..7b0995c2621c 100644
--- a/code/yarn.lock
+++ b/code/yarn.lock
@@ -2204,7 +2204,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.14.8, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.13, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.22.6, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.9.2":
+"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.14.8, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.20.13, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.22.6, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2":
version: 7.23.1
resolution: "@babel/runtime@npm:7.23.1"
dependencies:
@@ -2213,15 +2213,6 @@ __metadata:
languageName: node
linkType: hard
-"@babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.8.7":
- version: 7.22.15
- resolution: "@babel/runtime@npm:7.22.15"
- dependencies:
- regenerator-runtime: ^0.14.0
- checksum: 96b74adfd1db812d06ed56d9db12acecfc844d252b93994ce4901433957bd28affba725622a4dc9e7f76384c4cb6cadc3d620d07817c8be9156eaedba5eea059
- languageName: node
- linkType: hard
-
"@babel/runtime@npm:~7.5.4":
version: 7.5.5
resolution: "@babel/runtime@npm:7.5.5"
@@ -9015,18 +9006,7 @@ __metadata:
languageName: node
linkType: hard
-"@types/react@npm:*, @types/react@npm:>=16":
- version: 16.14.46
- resolution: "@types/react@npm:16.14.46"
- dependencies:
- "@types/prop-types": "*"
- "@types/scheduler": "*"
- csstype: ^3.0.2
- checksum: 815885cbae2c8653dddf8df4e6c2ce43ff8ff1d02c03f8356ce4b13aa7c8e6c72c588f04977c6f49fdd82419d46fdd895535d5e66726f0b0ea13c04065294995
- languageName: node
- linkType: hard
-
-"@types/react@npm:^16, @types/react@npm:^16.14.34":
+"@types/react@npm:*, @types/react@npm:>=16, @types/react@npm:^16, @types/react@npm:^16.14.34":
version: 16.14.48
resolution: "@types/react@npm:16.14.48"
dependencies: