From: Alden Daniels Date: Mon, 20 Apr 2015 16:25:29 +0000 (-0500) Subject: Load dygraph-combined when loading from NPM X-Git-Tag: v1.1.1~6 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=caf127be0c21fdd1c269e6555cb32c341bfefe44;p=dygraphs.git Load dygraph-combined when loading from NPM Today, when loading dygraphs from NPM via browserify you need to include: ```javascript var Dygraph = require('dygraphs/dygraph-combined.js'); ``` Being able to do this: ```javascript var Dygraph = require('dygraphs'); ``` Is preferable. Use "dev" combined version Minification should be handled by each app's build system. Export Dygraph Fix broken tests when module is not defined --- diff --git a/dygraph.js b/dygraph.js index eab46a2..3569ee1 100644 --- a/dygraph.js +++ b/dygraph.js @@ -3801,6 +3801,10 @@ Dygraph.addAnnotationRule = function() { console.warn("Unable to add default annotation CSS rule; display may be off."); }; +if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = Dygraph; +} + return Dygraph; })(); diff --git a/package.json b/package.json index 84948e9..bb758fd 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "dygraphs", "version": "1.1.0", "description": "dygraphs is a fast, flexible open source JavaScript charting library.", - "main": "dygraph.js", + "main": "dygraph-combined-dev.js", "directories": { "doc": "docs", "test": "tests"