Skip to content

UMD bundle can't be loaded into browser #234

@PabloDinella

Description

@PabloDinella
  • dom-testing-library version: 3.17.0
  • react version: N/A
  • node version: N/A
  • npm (or yarn) version: N/A

Relevant code or config:

/**
 *  Simple node.js style script loader for modern browsers
 **/
function loadScript(src, cb) {
  var script = document.createElement('script');
  script.async = true;
  script.src = src;

  script.onerror = function() {
    cb(new Error("Failed to load" + src));
  };

  script.onload = function() {
    cb();
  };

  document.getElementsByTagName("head")[0].appendChild(script);
}

What you did:

Trying to load DomTestingLibrary into the browser.

What happened:

dom-testing-library.umd.js:7 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at dom-testing-library.umd.js:7
    at dom-testing-library.umd.js:4
    at dom-testing-library.umd.js:5

Reproduction:

Run the config code above on the devtools and then:

loadScript('https://unpkg.com/dom-testing-library@3.17.0/dist/dom-testing-library.umd.js', () => {})

Problem description:

Hello, I was just trying to use dom-testing-library directly in the browser, like @kentcdodds did in this stream, but realized it works until the version 3.16.x of the library, starting from 3.17.0 I get the error above. Am I missing something or?

Suggested solution:

I have no idea why this happens, found no relevant changes in the commits on the 3.17.0 version :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    packagingBuild, compilation, or distribution problemreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions