Skip to content
New issue

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

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

Already on GitHub? # to your account

Difficulties including library in client-side code #24

Open
p3k opened this issue Oct 15, 2015 · 2 comments
Open

Difficulties including library in client-side code #24

p3k opened this issue Oct 15, 2015 · 2 comments

Comments

@p3k
Copy link

p3k commented Oct 15, 2015

When I include the library together with RequireJS like the following in an HTML page I get the error and stack trace below:

<script src='https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.20/require.js'></script>
<script>
  require(['http://cpettitt.github.io/project/graphlib-dot/latest/graphlib-dot.js'], function(dot) {
    console.log(dot);
  });
</script>
Uncaught TypeError: Cannot read property 'Graph' of undefined
  3../graphlib @ graphlib-dot.js:55
  s @ graphlib-dot.js:1
  (anonymous function) @ graphlib-dot.js:1
  8../build-graph @ graphlib-dot.js:2619
  s @ graphlib-dot.js:1
  (anonymous function) @ graphlib-dot.js:1
  2../lib/graphlib @ graphlib-dot.js:28
  s @ graphlib-dot.js:1
  (anonymous function) @ graphlib-dot.js:1
  (anonymous function) @ graphlib-dot.js:24
  1../index @ graphlib-dot.js:26
  s @ graphlib-dot.js:1e @ graphlib-dot.js:1
  (anonymous function) @ graphlib-dot.js:1

What do I need to do to make graphlib-dot work with RequireJS (which is a requirement)?

@cpettitt
Copy link
Collaborator

I don't have any experience with RequireJS, but there seem to be some issues with it and browserify, which is what I used to build the graphlib-dot bundle. See discussion / suggestions here: browserify/browserify#790.

@p3k
Copy link
Author

p3k commented Oct 15, 2015

Thanks for the pointer. I can confirm that it works when I add graphlib-dot with a <script> element before the one for RequireJS. Would be still neat to use graphlib-dot as RequireJS module, though.

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

No branches or pull requests

2 participants