Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
Obtener la promesa de error no está definido en IE11

Estoy convirtiendo el código React a mecanografiado, el objetivo en tsconfig es es5.

al ejecutar en IE 11 aparece el error "La promesa no está definida"

Sé que necesito polyfill, pero ¿cómo?

No estoy usando Babel.

Lo siguiente es mi Webpack.config

 var webpack = require("webpack"); var Promise = require('es6-promise').Promise; var paths = require('./config/paths'); var HtmlWebpackPlugin = require('html-webpack-plugin'); //var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); var AureliaWebpackPlugin = require('aurelia-webpack-plugin'); var publicPath = '/'; var publicUrl = ''; module.exports = { entry: { app: [ 'core-js/fn/promise', './Generated Files/app.js' ], vendor: paths.vendorPath, }, output: { path:__dirname + "/dist", filename: 'bundle.js', publicPath: publicPath }, devtool: '#source-map', resolve: { extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js'] }, module: { loaders: [ { test: /.tsx?$/, loader: 'ts-loader', exclude: /node_modules/ }, { test: /\.css$/, loader: 'style-loader!css-loader', //exclude: /node_modules/, }, { test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, loader: 'file', query: { name: 'static/media/[name].[hash:8].[ext]' } }, ] }, plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('development') } }), new HtmlWebpackPlugin({ inject: true, template: paths.appHtml, }), // For using jQuery new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", 'window.jQuery': 'jquery', 'window.$': 'jquery', }), new webpack.ProvidePlugin({ "Promise": "promise-polyfill" }), // new AureliaWebpackPlugin(), new webpack.optimize.CommonsChunkPlugin({/* chunkName= */name:"vendor", /* filename= */filename:'static/js/vendor.js'}) ] };
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

var ES6Promise = require("es6-promise"); ES6Promise.polyfill(); var axios = require("axios");

escribir esto arriba axios funcionó para mí tal vez otras opciones también funcionaron

era principalmente un problema de caché en IE que estaba enfrentando

la instalación es6-promise-promise webpack también funcionó

 npm install es6-promise-promise

e incluir

 new webpack.ProvidePlugin({ Promise: 'es6-promise-promise', // works as expected });

en los complementos del paquete web

editaré esta respuesta con más opciones posibles

over 4 years ago · Santiago Trujillo Report

0

Debe incluir Polyfill para que funcione en Internet Explorer.

 import { polyfill } from 'es6-promise'; polyfill();

Incluye polypill para navegadores/dispositivos que lo necesiten.

https://www.npmjs.com/package/polyfill-io-feature-detection

over 4 years ago · Santiago Trujillo Report

0

Agregue este script:

 <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>

Después de eso, puede probar en la consola si Promise está funcionando en IE

 var promise = new Promise(function (resolve, reject) { setTimeout(function () { resolve('bar'); }, 1000); }); promise.then(function(result) { console.log(result); });
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!