Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { mkdirSync } from 'fs';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import webpack from 'webpack';
import webpackConfig from '../webpack.config';
import SentryScenarioGenerationPlugin from './generatePlugin';
import SentryScenarioGenerationPlugin, { useLoader } from './generatePlugin';

export async function generatePage(
initPath: string,
Expand Down Expand Up @@ -30,6 +30,9 @@ export async function generatePage(
filename: outPageName,
template: templatePath,
inject: 'body',
// Deferred scripts may run after the loader has swapped in the CDN bundle but before it calls
// `init()`, so their SDK calls would be dropped. Blocking scripts always hit the loader stub.
scriptLoading: useLoader ? 'blocking' : 'defer',
}),
],
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const useCompiledModule = bundleKey === 'esm' || bundleKey === 'cjs';

// Bundles need to be injected into HTML before Sentry initialization.
const useBundleOrLoader = bundleKey && !useCompiledModule;
const useLoader = bundleKey.startsWith('loader');
export const useLoader = bundleKey.startsWith('loader');

// These are imports that, when using CDN bundles, are not included in the main CDN bundle.
// In this case, if we encounter this import, we want to add this CDN bundle file instead
Expand Down
Loading