Skip to content

Commit 92c9567

Browse files
committed
Solve the issue with AMD definitions inside our code. closes auth0#172
1 parent c38bfbe commit 92c9567

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

standalone.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,20 @@
66
* Those who use browserify will install with npm and require the module,
77
* the package.json file points to index.js.
88
*/
9+
10+
11+
//temporary disable define from AMD.
12+
var old_define = global.define;
13+
global.define = undefined;
14+
915
var Auth0Lock = require('./');
1016

17+
//restore define
18+
global.define = old_define;
19+
1120
// use amd or just throught to window object.
12-
if (typeof global.window.define == 'function' && global.window.define.amd) {
13-
global.window.define('auth0-lock', function () { return Auth0Lock; });
14-
} else if (global.window) {
15-
global.window.Auth0Lock = Auth0Lock;
21+
if (typeof global.define == 'function' && global.define.amd) {
22+
global.define('auth0-lock', function () { return Auth0Lock; });
23+
} else if (global) {
24+
global.Auth0Lock = Auth0Lock;
1625
}

0 commit comments

Comments
 (0)