HEY
HO
Are the circles joined with two connections?

Yes

The first connection is made through a static instance of jsPlumb, which was registered on the window object by the built webpack bundle. The second connection is made by an instance of jsPlumb which is returned from a `require` call to some JS inside the bundle.

No

You need to run a couple of npm commands in the project root.

npm install
  1. Installs jsPlumb's dependencies

  2. Builds the final version of jsPlumb (not actually required for this demo; just telling you).
  3. Builds (and renames, to remove the version suffix, so we dont have to keep updating this page) the bundle that would be published to npm via the npm publish command. In this demo we use a local require in our package json:

      "devDependencies": {
        "grunt-webpack": "^1.0.11",
        "jsplumb": "file:../../jsplumb.tgz",
        "webpack": "^1.13.1",
        "webpack-dev-server": "^1.14.1"
      }
                        
    but we'd expect you to require jsPlumb from the npm repo:
      "devDependencies": {
        "grunt-webpack": "^1.0.11",
        "jsplumb": "X.X.X",
        "webpack": "^1.13.1",
        "webpack-dev-server": "^1.14.1"
      }
                        

npm run init

  1. Runs npm install in this demo's directory.

    To get webpack and jsPlumb.

  2. Runs grunt build in this demo's directory

    Which runs webpack and generates a bundle.js file in the dist directory of this demo

    The webpack config is in the file webpack.config.js

    var path = require("path");
    var webpack = require("webpack");
    module.exports = {
        cache: true,
        entry: {
            bundle: "./index.js"
        },
        output: {
            path: path.join(__dirname, "dist"),
            publicPath: "dist/",
            filename: "[name].js",
            chunkFilename: "[chunkhash].js"
        }
    };
                        
The init script recurses through each directory in the project and runs npm install when it finds a package.json, and grunt build when it finds a Gruntfile.js.