WebPack HMR with Edge

Tags: WebPack, hot module reload, HMR, Aurelia

To get WebPack hot module reload to work with Edge you need a polyfill.

Add it to your project:

npm i event-source-polyfill

Then add it to your vendor.config.js file at the end of the vendor array.

    entry: {
      vendor: [
        'aurelia-event-aggregator',
        ...
        'bootstrap',
        'bootstrap/dist/css/bootstrap.css',
        'jquery',
        'event-source-polyfill'
      ],
    },

Or with webpack4

    plugins: [
      new webpack.DefinePlugin({ IS_DEV_BUILD: JSON.stringify(isDevBuild) }),
      new webpack.ProvidePlugin({
        "window.EventSource": ['event-source-polyfill', 'EventSourcePolyfill'],
        $: "jquery", jQuery: "jquery", "window.jQuery": "jquery"
      }),

No Comments