Getting Babel 6 to work with IE8 (via. Gulp / Webpack)

I have Babel 6 working great with Gulp and Webpack. Now I need a polyfill to get IE8 support.

I installed babel-polyfill, but I canโ€™t get it to work, and the documents and Google have not yet helped.

My Gulp task (including Webpack configuration):

gulp.task('webpack', function(callback) { var webpackConfig = { context: __dirname + '../../../js', entry: { homepage: [ 'babel-polyfill', './public/homepage/homepage.js' ] }, output: { path: __dirname + '../../../dist/public/scripts/', filename: '[name].bundle.js' }, module: { loaders: [ { loader: 'babel-loader', test: /\.js$/, // Only run .js files through Babel include: /js/, // Only include the /js dir query: { //plugins: ['transform-runtime'], // Disabled pending fix to https://github.com/babel/babel/issues/2954 presets: ['es2015'],//, 'stage-0' } } ] } }; webpack(webpackConfig, function(err, stats) { if (err) { throw new gutil.PluginError('webpack', err); } gutil.log('[webpack]', stats.toString({ // output options })); callback(); }); }); 

From the docs ( https://babeljs.io/docs/usage/polyfill/ ):

Using Node / Browserify / Webpack

To enable polyfill, you need to specify it at the top of the entry point in> your application.

required ("babel-polyfill");

Use in browser

Available from dist / polyfill.js in the babel-polyfill npm version. This should be included before all your compiled Babel code. You can either add it to the compiled code, or include it in front of it.

NOTE. Do not require this through a browser, etc., use babel-polyfill.

I tried just adding the polyfill.js file to the top of the page, but IE8 is still not happy with the compiled code for using the default keyword.

I also tried adding polyfill to the webpack process, according to http://jamesknelson.com/using-es6-in-the-browser-with-babel-6-and-webpack/ and other suggestions from google

What am I doing wrong?

+7
internet-explorer-8 webpack babeljs
source share

No one has answered this question yet.

See similar questions:

23
Babel 6.0.20. Modules do not work in IE8
5
How to polyfill Array.prototype.find using webpack ProvidePlugin?

or similar:

1203
NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. Webpack
204
How to create source files using babel and webpack?
nine
Babel polyfill is turned on, but forEach still doesn't work in IE11 in NodeLists
3
How to import npm module into ES6 project?
2
Getting Webpack 2 to support IE8
2
Webpack with babel downloader for processing damaged image files
one
jet loader and webpack do not work
one
cannot import IMG_VAR from './images/name.jpg' with babel / React / Webpack
one
Relays, webpack and babel do not work as described
one
Using gulp, webpack and babel-loader: cannot compile jsx

All Articles