question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading babel-polyfill for IE11

See original GitHub issue

I have my first component working in Storybook, and everything is fine on Chrome and Firefox, but in IE11, I get the error Object doesn't support property or method 'find' when Storybook is trying to find a story in an array.

This seems to be because Array.find() needs to be polyfilled.

The solution should be to add import 'babel-polyfill; to the entrypoint, but I can’t seem to find the right place to put this with Storybook (i.e., what constitutes the “entrypoint”).

I’ve tried adding it to my component’s index.js, as well as at the top of each of my story files, and also in .storybook/config.js, but I still get the same error in IE11. I also tried adding module.entry=['babel-polyfill'] in the webpack.config.js, with no difference.

Any other suggestions?

I’m using start-storybook -p 9001 -s ./stories rather than a custom server.js if that matters.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:16
  • Comments:38 (20 by maintainers)

github_iconTop GitHub Comments

6reactions
mindjuicecommented, May 30, 2016

I downloaded the repo and used npm link to connect it to my project.

If I add import 'babel-polyfill'; as the first line of /src/client/manager/index.js, then everything loads properly in IE11.

It also works if I instead change the /src/client/manager/webpack.manager.conf.js to have the following entry points:

  entry: ['babel-polyfill', path.resolve(__dirname, '../src/client/manager/index.js')],

Can anyone else confirm if Storybook works for them in IE11 without one of these changes?

Also, for some reason, I needed to npm install babel-plugin-stage-0 --save-devand rerun npm run prepublish in @kadira/react-storybook in order for my own app build to succeed. Without it, I got this error in my own app’s build:

... truncated earlier lines
  [469] ./~/webpack-hot-middleware/client-overlay.js 1.73 kB {0} [built]
  [470] ./~/webpack-hot-middleware/client.js 4.18 kB {0} [built]
  [471] ./~/webpack-hot-middleware/process-update.js 3.88 kB {0} [built]
chunk    {1} manager.bundle.js (manager) 325 kB [rendered]
    [0] multi manager 28 bytes {1} [built]
  [209] /Users/kenc/dev/react-storybook/dist/manager.js 325 kB {1} [built]

ERROR in /Users/kenc/dev/react-storybook/dist/server/error_enhancements.js
Module build failed: Error: Couldn't find preset "stage-0" relative to directory "/Users/kenc/dev/react-storybook/dist/server"
    at /Users/kenc/dev/web-components/tagged-token/node_modules/babel-core/lib/transformation/file/options/option-manager.js:372:17
    at Array.map (native)
    at OptionManager.resolvePresets (/Users/kenc/dev/web-components/tagged-token/node_modules/babel-core/lib/transformation/file/options/option-manager.js:364:20)
    at OptionManager.mergePresets (/Users/kenc/dev/web-components/tagged-token/node_modules/babel-core/lib/transformation/file/options/option-manager.js:348:10)
    at OptionManager.mergeOptions (/Users/kenc/dev/web-components/tagged-token/node_modules/babel-core/lib/transformation/file/options/option-manager.js:307:14)
    at OptionManager.init (/Users/kenc/dev/web-components/tagged-token/node_modules/babel-core/lib/transformation/file/options/option-manager.js:465:10)
    at File.initOptions (/Users/kenc/dev/web-components/tagged-token/node_modules/babel-core/lib/transformation/file/index.js:194:75)
    at new File (/Users/kenc/dev/web-components/tagged-token/node_modules/babel-core/lib/transformation/file/index.js:123:22)
    at Pipeline.transform (/Users/kenc/dev/web-components/tagged-token/node_modules/babel-core/lib/transformation/pipeline.js:45:16)
    at transpile (/Users/kenc/dev/web-components/tagged-token/node_modules/babel-loader/index.js:14:22)
 @ multi preview

Not sure if this is just because my project is using stage-0 or if perhaps it’s related to using npm link instead of a proper release.

@arunoda Would you accept a PR for adding babel-polyfill? Also, are you able to test under IE11?

Thanks!

4reactions
Nickman87commented, Aug 25, 2016

IE11 does not like the latest version of storybook (2.5.1) either. Seems like some other polyfills are still missing.

image

You want me to try and find out more about this issue or is somebody already on it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use babel/corejs3/webpack correctly for IE11?
You'll have to normally import the modules you want to use (i.g. Postmate) inside your code entry file; no polyfills; every polyfill used...
Read more >
Support IE 11 Using Babel and Webpack | by Rameez Aijaz
To get all the required polyfills for the list of target browsers. Load Core-JS: Last but not the least we need to load...
Read more >
IE11 and the Missing Polyfills - DEV Community ‍ ‍
What does it do? It replaces @babel/polyfill with polyfills actually required by target system, sometimes just halving their count. Once you ...
Read more >
babel/polyfill
It is automatically loaded when using @babel/preset-env 's useBuiltIns: "usage" option or @babel/plugin-transform-runtime . Babel includes a polyfill that ...
Read more >
How to load polyfills only when needed
the /polyfills/full.min.js script will only load in browsers that don't support ES2015 and don't recognize the nomodule attrubute – e.g., IE11 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found