How can I tell webpack to automatically do:
require('es5-shim/es5-shim');
require('es5-shim/es5-sham');
Every time I require('react')?
I have multiple entry points in the same project, and I would want to avoid pasting the requires everywhere.
Also, my tests are running on PhantomJS 1.9, which doesn't implement Function.bind, so I'd also benefit from automatically requiring the shims there...
You can use the imports-loader to inject the requires:
module: { loaders: [
{ test: require.resolve("react"), loader: "imports?shim=es5-shim/es5-shim&sham=es5-shim/es5-sham" }
]}
You can also try: https://github.com/deepsweet/autopolyfiller-loader
Nice, thank you very much!
@sokra
Thank you for your answer!
Most helpful comment
You can use the imports-loader to inject the requires:
You can also try: https://github.com/deepsweet/autopolyfiller-loader