Skip to content

Commit

Permalink
Merge pull request #17141 from storybookjs/fix/ie11AgainAndAgainAndAgain
Browse files Browse the repository at this point in the history
Core: Fix IE support by transpiling more libs to es5
  • Loading branch information
shilman committed Jan 6, 2022
2 parents 19686fb + eb2fb1c commit d3adeb8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
15 changes: 9 additions & 6 deletions addons/interactions/src/Panel.tsx
Expand Up @@ -121,12 +121,15 @@ export const Panel: React.FC<AddonPanelProps> = (props) => {

const endRef = React.useRef();
React.useEffect(() => {
const observer = new global.window.IntersectionObserver(
([end]: any) => setScrollTarget(end.isIntersecting ? undefined : end.target),
{ root: global.window.document.querySelector('#panel-tab-content') }
);
if (endRef.current) observer.observe(endRef.current);
return () => observer.disconnect();
let observer: IntersectionObserver;
if (global.window.IntersectionObserver) {
observer = new global.window.IntersectionObserver(
([end]: any) => setScrollTarget(end.isIntersecting ? undefined : end.target),
{ root: global.window.document.querySelector('#panel-tab-content') }
);
if (endRef.current) observer.observe(endRef.current);
}
return () => observer?.disconnect();
}, []);

const emit = useChannel(
Expand Down
5 changes: 5 additions & 0 deletions lib/core-common/src/utils/es6Transpiler.ts
Expand Up @@ -4,6 +4,7 @@ import { getStorybookBabelConfig } from './babel';
const { plugins } = getStorybookBabelConfig();

const nodeModulesThatNeedToBeParsedBecauseTheyExposeES6 = [
'@storybook[\\\\/]expect',
'@storybook[\\\\/]node_logger',
'@testing-library[\\\\/]dom',
'@testing-library[\\\\/]user-event',
Expand All @@ -22,14 +23,18 @@ const nodeModulesThatNeedToBeParsedBecauseTheyExposeES6 = [
'find-up',
'fs-extra',
'highlight.js',
'jest-mock',
'json5',
'node-fetch',
'pkg-dir',
'prettier',
'pretty-format',
'react-router',
'react-router-dom',
'resolve-from',
'semver',
'slash',
'strip-ansi',
].map((n) => new RegExp(`[\\\\/]node_modules[\\\\/]${n}`));

export const es6Transpiler: () => RuleSetRule = () => {
Expand Down

0 comments on commit d3adeb8

Please sign in to comment.