-
Notifications
You must be signed in to change notification settings - Fork 3
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
How to add package? #818
Comments
Here's an example, from https://vizhub.com/curran/visualizing-population-centers?edit=files&file=package.json {
"dependencies": {
"d3": "7.8.2",
"topojson-client": "3.1.0"
},
"license": "MIT",
"vizhub": {
"libraries": {
"d3": {
"global": "d3",
"path": "/dist/d3.min.js"
},
"topojson-client": {
"global": "topojson",
"path": "/dist/topojson-client.min.js"
}
}
}
} To add a new package as a dependency in VizHub using package.json, you need to know:
The package name and version go under Here's an example of the generated script tags, also from https://vizhub.com/curran/visualizing-population-centers <head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/d3.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/topojson-client.min.js"></script>
</head> Then, when the code is built in the VizHub runtime using Rollup, the information of the global variable and package name is used to tell Rollup to resolve imports from those packages to the browser globals. This is why the VizHub builds are so fast, because they do not include all the code of the dependencies, but rather just refer to the globals. I hope this helps! |
How to add Topojson in package.json
The text was updated successfully, but these errors were encountered: