https://github.com/plotly/plotly.js
Raw File
Tip revision: 3fce26ee6873926d3b2d94aa3986d9b7ffa1dfe7 authored by Mojtaba Samimi on 15 March 2023, 17:47:52 UTC
2.20.0
Tip revision: 3fce26e
test_requirejs.js
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() {};

var requirejs = require('requirejs');

requirejs.config({
    paths: {
        'plotly': '../dist/plotly.min'
    }
});

requirejs(['plotly'],
function(plotly) {
    if(plotly) {
        console.log(plotly);
    } else {
        throw 'Error: loading with requirejs';
    }
});
back to top