question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Edge, IE11 broken. Invalid bundling and exports.

See original GitHub issue

Currently bundling for Webpack environments / module environments is broken. In the Webpack build the library is build and transpiled - although in package.json it only points to the root (unstranspiled) /wpapi.js file. This is okay for most modern browsers as - only by chance - the features are supported.

Although this is not the case for Edge and IE11 both not supporting the object rest spread operator.

In summary the build is essentially broken for browsers environments - node works.

This long standing issue: https://github.com/WP-API/node-wpapi/issues/426 outlines the case with specific errors.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
andrewmclagancommented, Sep 19, 2019

Workaround for those Webpack / bundler users who want support for Edge and IE 11 you can simply add the “browser” bundle (umd) as an external dependancy. Bundling it via package.json (node_modules) will break your build in IE and Edge.

Webpack e.g.


/**
 * Webpack config object
 * @return {Object}
 */
module.exports = (env, argv) => {
    // ...
    externals: {
      wpapi: 'WPAPI'
    },    
    // ...
};

Then import as usual:

import WPAPI from "wpapi";

😦

My suggestion to the authors would be to write the library in ES then transpile to CJS and UMD. That way we are working from best case to worst case, smallest footprint.

2reactions
nsundbergcommented, Oct 11, 2019

Workaround for those Webpack / bundler users who want support for Edge and IE 11 you can simply add the “browser” bundle (umd) as an external dependancy. Bundling it via package.json (node_modules) will break your build in IE and Edge.

If you want to avoid editing the Webpack config and/or including it using a script tag you can also import the browser bundle directly:

import WPAPI from 'wpapi/browser/wpapi.min';
Read more comments on GitHub >

github_iconTop Results From Across the Web

Internet Explorer (IE) mode troubleshooting and FAQ
How to troubleshoot and fix · Open a new tab in Microsoft Edge and go to edge://net-export. · Select Start Logging to Disk,...
Read more >
React Development and Build version not working in IE 11 ...
Development and build version not working in IE 11 and Edge. Here are my webpack config and package json file.
Read more >
How To Fix Your Angular App When It's Not Working in IE11
Usually, if the browser does not support a CSS property the styling will look weird (e.g. an element is positioned in the wrong...
Read more >
Automation 360 and Internet Explorer 11 EOL FAQ
Due to the difference in the height of the header bar in Internet Explorer and Microsoft Edge with Internet Explorer mode, an incorrect...
Read more >
To v5 from v4 - webpack
Upgrade webpack to 5 · Clean up configuration · Need to support an older browser like IE 11? · Cleanup the code ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found