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

using techan as an AMD module, get error #219

Open
overwatch13 opened this issue Feb 22, 2018 · 5 comments
Open

using techan as an AMD module, get error #219

overwatch13 opened this issue Feb 22, 2018 · 5 comments

Comments

@overwatch13
Copy link

Hi, is it possible to use techanjs when using requireJS?

Upon initial load immediately get this error.
techan-error

@briancappello
Copy link
Contributor

Have you tried the solutions in this issue?

@overwatch13
Copy link
Author

overwatch13 commented Feb 22, 2018 via email

@ccancellieri
Copy link

Guys take a look to the #220 hope this helps
I've created a branch on my fork called modules to be able to use techan as ES6 module in my project.
Since I don't think the pull request will be included I've checked out that branch to a subfolder of my project and then simply:
import { techan } from './techan/techan';

@llach
Copy link

llach commented Mar 3, 2018

@overwatch13
had the same issue as you did. i ended up cloning this repo and editing the src/techan.js.

First, remove the following lines:


// If running in browser (window !undefined), assume d3 available
if('undefined' != typeof window) _d3 = window.d3;
else if('object' == typeof module) _d3 = require('d3'); // else we're in the only other supported mode: v8/node
else throw "Unsupported runtime environment: Could not find d3. Ensure defined globally on window, or available as dependency.";

Then change

var _d3;

to

var _d3 = require('d3');

Generate dist/techan.js anew and require it. Done!

JS really is annoying when it comes to conventions. Hope this lib is worth it.

@slavikdenis
Copy link

This solved the problem for me: #179 (comment)

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

5 participants