-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6440 from plotly/false-umdNamedDefine
Fix library's imported name using `requirejs` AMD loader
- Loading branch information
Showing
9 changed files
with
46 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ node_modules | |
dist | ||
build | ||
|
||
tasks/test_amdefine.js | ||
tasks/test_requirejs.js | ||
test/jasmine/assets/jquery-1.8.3.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fix library's imported name using `requirejs` AMD loader (regression introduced in 2.17.0) [[#6440](https://github.com/plotly/plotly.js/pull/6440)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var JSDOM = require('jsdom').JSDOM; | ||
global.document = new JSDOM('<!DOCTYPE html><head></head><html><body></body></html>').window.document; | ||
global.window = document.defaultView; | ||
global.window.document = global.document; | ||
global.self = global.window; | ||
global.Blob = global.window.Blob; | ||
global.DOMParser = global.window.DOMParser; | ||
global.getComputedStyle = global.window.getComputedStyle; | ||
global.window.URL.createObjectURL = function() {}; | ||
|
||
// see: Building node modules with AMD or RequireJS https://requirejs.org/docs/node.html | ||
if(typeof define !== 'function') { | ||
var define = require('amdefine')(module); | ||
} | ||
|
||
define(function(require) { | ||
var plotly = require('../dist/plotly.min.js'); | ||
|
||
if(plotly) { | ||
console.log(plotly); | ||
} else { | ||
throw 'Error: loading with amdefine'; | ||
} | ||
|
||
// The value returned from the function is | ||
// used as the module export visible to Node. | ||
return function() {}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters