Skip to content

Work with require.js in browser #50

@pats

Description

@pats

Hello,

It would be nice if this library would work with d3 and require.js in browser.

Now i have an error:

Uncaught TypeError: Cannot read property 'select' of undefined 

My require.js config and usage

require.config({
    paths: {
        'jquery': '../bower_components/jquery/dist/jquery',
        'jquery-form': '../bower_components/jquery-form/jquery.form',
        'lodash': '../bower_components/lodash/dist/lodash',
        'd3': '../bower_components/d3/d3',
        'bootstrap': '../bower_components/bootstrap/dist/js/bootstrap',
        'dagreD3':'../bower_components/dagre-d3/index'
    },
    shim: {
        'jquery': {
            exports: '$'
        },
        'jquery-form': ['jquery'],
        'lodash': {
            exports: '_'
        },
//        'd3': {
//            exports: 'd3'
//        },
        'bootstrap': ['jquery'],
        'dagreD3': {
            deps: ['d3'],
            exports: 'dagreD3'
        }
    }
});

usage

define(['jquery', 'lodash', 'dagreD3', 'bootstrap'], function($, _, dagreD3) {

    var d3 = require('d3');

....

Best regards,
patS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions