Reputation: 37909
I am using Aurelia 1.1 with the Webpack 2.0 plugin. This works fine in Chrome, but in IE, there is no promise.
So I get an error message on this:
var startPromise = new Promise(function (resolve) {
return startResolve = resolve;
});
I have downloaded the es6 polyfill with npm, but I don't know how to tell webpack to include it so it can be used universally.
How should I be including this polyfill?
Upvotes: 0
Views: 736
Reputation: 222474
The usual thing for ES6 apps is to have polyfills included (e.g. core-js
). This should be done once per app, as early as possible, before other libraries:
import 'core-js/es6';
Considering that aurelia-polyfills
is already used, polyfills can be included selectively to not collide with the ones from aurelia-polyfills
:
import 'core-js/es6/promise';
import 'core-js/es6/function';
...
Upvotes: 1
Reputation: 37909
I don't know that this is the best way, but it worked for me:
In webpack.config.js:
const webpack = require("webpack");
...
plugins: [
new webpack.ProvidePlugin({
Promise: 'es6-promise-promise'
})
]
Note that the "es6-promise-promise" lib was installed.
More on Plug-ins:
Upvotes: 0