From caf127be0c21fdd1c269e6555cb32c341bfefe44 Mon Sep 17 00:00:00 2001 From: Alden Daniels Date: Mon, 20 Apr 2015 11:25:29 -0500 Subject: [PATCH] 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 --- dygraph.js | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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" -- 2.7.4