繁体   English   中英

在Internet Explorer中获取未定义的诺言错误

[英]Getting promise not defined error in Internet Explorer

我正在处理一个包含诺言的代码,我想在IE11上运行它。 当我尝试使用IE运行代码时,得到的承诺没有在Interne Explorer中定义。

我看到有使用babel-polyfill的解决方案,但是我想在没有babel-polyfill的情况下解决此问题,我该怎么办?

webpack配置

var path = require('path')

module.exports = {
  entry: path.resolve(__dirname, 'partner/index.js'),
  output: {
    path: path.resolve(__dirname, './dist'),
    filename: 'partner_bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.js$/, // Check for all js files
        exclude: /(node_modules)/,
        loader: 'babel-loader',
        query: {
          presets: ['env'],
          plugins: ['transform-runtime', 'transform-object-rest-spread']
        }
      }
    ]
  },
  stats: {
    colors: true
  },
  devtool: 'source-map'
}

Internet Explorer 根本不支持该承诺。

您将必须使用polyfill。 如果您不想使用babel-polyfill ,但仍希望使用ES6样式的诺言,则需要使用另一种。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM