Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Fix module guard in non-webpack environments #22085

Merged
merged 2 commits into from
Apr 17, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/frameworks/angular/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export type { StoryFnAngularReturnType as IStory } from './types';
export { moduleMetadata, componentWrapperDecorator, applicationConfig } from './decorators';

// optimization: stop HMR propagation in webpack
module?.hot?.decline();
if (typeof module !== 'undefined') module?.hot?.decline();
2 changes: 1 addition & 1 deletion code/frameworks/ember/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
export { storiesOf, configure, forceReRender, raw } from './client/preview';

// optimization: stop HMR propagation in webpack
module?.hot?.decline();
if (typeof module !== 'undefined') module?.hot?.decline();
2 changes: 1 addition & 1 deletion code/renderers/html/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export * from './public-api';
export * from './public-types';

// optimization: stop HMR propagation in webpack
module?.hot?.decline();
if (typeof module !== 'undefined') module?.hot?.decline();
2 changes: 1 addition & 1 deletion code/renderers/preact/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export * from './public-api';
export * from './public-types';

// optimization: stop HMR propagation in webpack
module?.hot?.decline();
if (typeof module !== 'undefined') module?.hot?.decline();
2 changes: 1 addition & 1 deletion code/renderers/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export * from './public-types';
export * from './testing-api';

// optimization: stop HMR propagation in webpack
module?.hot?.decline();
if (typeof module !== 'undefined') module?.hot?.decline();
2 changes: 1 addition & 1 deletion code/renderers/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export * from './public-api';
export * from './public-types';

// optimization: stop HMR propagation in webpack
module?.hot?.decline();
if (typeof module !== 'undefined') module?.hot?.decline();
2 changes: 1 addition & 1 deletion code/renderers/svelte/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export * from './public-api';
export * from './public-types';

// optimization: stop HMR propagation in webpack
module?.hot?.decline();
if (typeof module !== 'undefined') module?.hot?.decline();
2 changes: 1 addition & 1 deletion code/renderers/vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export * from './public-api';
export * from './public-types';

// optimization: stop HMR propagation in webpack
module?.hot?.decline();
if (typeof module !== 'undefined') module?.hot?.decline();
2 changes: 1 addition & 1 deletion code/renderers/vue3/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export * from './public-api';
export * from './public-types';

// optimization: stop HMR propagation in webpack
module?.hot?.decline();
if (typeof module !== 'undefined') module?.hot?.decline();
2 changes: 1 addition & 1 deletion code/renderers/web-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export * from './public-api';
export * from './framework-api';

// TODO: disable HMR and do full page loads because of customElements.define
if (module && module.hot && module.hot.decline) {
if (typeof module !== 'undefined' && module?.hot?.decline) {
module.hot.decline();

// forcing full reloads for customElements as elements can only be defined once per page
Expand Down