Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newbie question: How to use without doing "grunt dist" #33

Open
magjac opened this issue Apr 6, 2017 · 4 comments
Open

Newbie question: How to use without doing "grunt dist" #33

magjac opened this issue Apr 6, 2017 · 4 comments

Comments

@magjac
Copy link

magjac commented Apr 6, 2017

While developing/debugging, it would be nice to have shorter iterations that the one minute it takes to "grunt dist". I tried "grunt build" and used:

requirejs.config({
    //By default load any module IDs from js/lib
    baseUrl: '/bower_components/graphviz-d3-renderer/src/js',
    //except, if the module ID starts with "app",
    //load it from the js/app directory. paths
    //config is relative to the baseUrl, and
    //never includes a ".js" extension since
    //the paths config could be for a directory.
    paths: {
        d3: '/bower_components/d3/d3',
        "dot-checker": '/bower_components/graphviz-d3-renderer/src/js/dot-checker',
        "layout-worker": '/bower_components/graphviz-d3-renderer/src/js/layout-worker',
        worker: '/bower_components/requirejs-web-workers/src/worker',
        renderer: '/bower_components/graphviz-d3-renderer/src/js/renderer'
    }
});

But in Chrome Version 57.0.2987.110 (64-bit) on Ubuntu 14.04, I get:

layout-worker.js:18 Uncaught DOMException: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': TypeError: viz is not a function could not be cloned.
at onmessage (http://madrox.netinsight.se:8084/bower_components/graphviz-d3-renderer/src/js/layout-worker.js:18:9)
layout-worker.js:18 Uncaught DataCloneError: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': TypeError: viz is not a function could not be cloned.

And with Firefox 48.0 on Ubuntu 14.04, I get:

DataCloneError: The object could not be cloned.layout-worker.js:18

Is there a better way? graphviz.it has "grunt development", but not graph-viz-d3-js

@magjac
Copy link
Author

magjac commented Apr 6, 2017

Some debugging shows that the reason for the exception is that viz is undefined in https://github.com/mstefaniuk/graph-viz-d3-js/blob/master/src/js/transformer.js#L6

To me, this is strange since viz loads without problems:
GET
http://madrox.netinsight.se:8084/bower_components/graphviz-d3-renderer/lib/viz.js/viz.js [HTTP/1.1 304 Not Modified 65ms]

@mstefaniuk
Copy link
Owner

To be honest I usually try to define test for changes in this component and then I'm using it in graphviz.it website.

If you want to use non-minified versions directly I suppose you should to add path to viz.js. Bundled worker has inlined this library.

@magjac
Copy link
Author

magjac commented Apr 7, 2017

viz.js is found as it is. I've added an explicit path to it, but the problem persists. The problem is not that it in not found. The problem seems to have something to to with how it's initialized. That's why the viz argument to the function in
define(['viz', 'parser/xdot', 'pegast'], function (viz, xdotparser, pegast) {
is undefined.

I can have a look at the development setup for graphviz.it for clues.

What do you mean with "undled worker has inlined this library.". Is it that the code is incorporated in dist/layout-worker.js?

@mstefaniuk
Copy link
Owner

mstefaniuk commented Apr 14, 2017

Exactly. I had problem you mentioned for long time and solved it in that way.

But to reiterate - I would prefer to add a test for output result in rendering component instead of testing it through graphviz.it development version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants