Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The UMD build is not loadable into JavaScript modules strict mode context e.g. into the Chrome DevTools console #139

Open
sompylasar opened this issue Aug 3, 2018 · 0 comments

Comments

@sompylasar
Copy link

I'm trying to use deep-diff in the Chrome DevTools debugger to compare two objects while sitting paused on a breakpoint, for that I'm trying to use import() to load deep-diff into the page to use it later via a global variable when paused.

To reproduce the failure to load, try running this in Chrome DevTools console (Chrome 67):

import('https://unpkg.com/[email protected]/index.js').then((module) => { console.log(module) })

Actual:

Uncaught (in promise) TypeError: Cannot set property 'DeepDiff' of undefined
    at index.js:521
    at index.js:2
    at index.js:23

Expected: it loads fine and prints the module exports.

Here's what needs to change in the UMD wrapper:

- }(this, function (root) {
+ }(typeof self !== 'undefined' ? self : this, function (root) {

Related: umdjs/umd#124 umdjs/umd#125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant