Skip to content

🎥 Make videos programmatically with React

fix: Wrap __webpack_module__ check in try-catch to prevent ReferenceError

Jonny Burger071cca24a3df
diff --git a/packages/core/src/nonce.ts b/packages/core/src/nonce.ts
index d9e51402fd..b81a855a00 100644
--- a/packages/core/src/nonce.ts
+++ b/packages/core/src/nonce.ts
@@ -31,14 +31,18 @@ declare const __webpack_module__: {
};
};
-if (typeof __webpack_module__ !== 'undefined') {
- if (__webpack_module__.hot) {
- __webpack_module__.hot.addStatusHandler((status) => {
- if (status === 'idle') {
- fastRefreshNonce++;
- }
- });
+try {
+ if (typeof __webpack_module__ !== 'undefined') {
+ if (__webpack_module__.hot) {
+ __webpack_module__.hot.addStatusHandler((status) => {
+ if (status === 'idle') {
+ fastRefreshNonce++;
+ }
+ });
+ }
}
+} catch {
+ // __webpack_module__ may throw ReferenceError in some environments
}
export const useNonce = (): NonceHistoryContext => {