Using other npm libraries

Hi,

I am looking to make interactive documentation for library g1.

I want to embed runkit into that web page like lodash does.

When I import g1 library like require('g1')

SyntaxError

message: "Unexpected token export"

![|9x10](https://static.runkitcdn.com/assets/images/disclosure-triangle.svg)SyntaxError Prototype

What could be the problem, how to embed runkit into my website, any help(documentation, videos) could be appreciated

Thanks

Perhaps the problem is that g1 is a javascript library for the web, not a node library. export is ES6 module syntax, not node’s CommonJS syntax, hence “unexpected token”. I don’t think you can use it on runkit because you’d have to use Babel or something to convert it. If this is your library or you know the creator, maybe g1 can be made compatible with node.

That’s correct, node doesn’t currently support the new module syntax and thus doesn’t work in RunKit yet.

That said, it looks like the package includes a dist folder, so you can likely use it by requiring the built file directly:

-https://runkit.com/me1000/5c2be6b902092900138b7d5b