Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet explorer 8 让Babel 6与IE8协同工作(通过.Gulp/Webpack)_Internet Explorer 8_Webpack_Babeljs - Fatal编程技术网

Internet explorer 8 让Babel 6与IE8协同工作(通过.Gulp/Webpack)

Internet explorer 8 让Babel 6与IE8协同工作(通过.Gulp/Webpack),internet-explorer-8,webpack,babeljs,Internet Explorer 8,Webpack,Babeljs,我有巴别塔6与大口大口喝和网页包很好地工作。我现在需要填充它以获得IE8支持 我已经安装了babel polyfill,但无法让它工作,文档和谷歌迄今为止也没有帮助 我的吞咽任务(包括网页包配置): gulp.task('webpack', function(callback) { var webpackConfig = { context: __dirname + '../../../js', entry: { homepage: [ 'babe

我有巴别塔6与大口大口喝和网页包很好地工作。我现在需要填充它以获得IE8支持

我已经安装了babel polyfill,但无法让它工作,文档和谷歌迄今为止也没有帮助

我的吞咽任务(包括网页包配置):

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();
  });
});
从文档()中:

在节点/Browserify/Webpack中的用法

要包含polyfill,您需要将其放在>应用程序入口点的顶部

要求(“巴别塔polyfill”)

在浏览器中的用法

可从babel polyfill npm发行版中的dist/polyfill.js文件获得。这需要包含在所有编译的Babel代码之前。您可以在编译后的代码中预先添加它,也可以在它之前将它包含在

注:不需要通过browserify等进行此操作,请使用babel polyfill

我试着简单地将polyfill.js文件添加到页面顶部,但IE8仍然不满意编译后的代码使用
default
关键字

我也尝试过将polyfill添加到网页包过程中,正如Google和其他建议所述


我做错了什么?

我遇到了同样的问题,看起来您现在需要为
默认值
和其他关键字使用单独的babel插件,请参见此处的答案:谢谢-该线程解释了发生了什么。真希望他们能修复这方面的劣质文档!