roughViz icon indicating copy to clipboard operation
roughViz copied to clipboard

Installation via npm contains additional roughviz.min.js

Open MintyMods opened this issue 5 years ago • 6 comments

Not really an issue but thought I would mention it. When installed via npm the dist folder contains two resources for the minified code:-

image

It wasn't immediately clear which one to use so maybe you can remove one.

Thanks for a great package.

MintyMods avatar Oct 19 '19 10:10 MintyMods

Thanks!

I believe I can fix this by simply renaming roughviz.min.js to index.js? If not do you know a correct solution? I don't do too much front-end stuff so the npm stuff can be a bit of a hassle at times!

jwilber avatar Oct 22 '19 15:10 jwilber

I believe I can fix this by simply renaming roughviz.min.js to index.js?

Sorry I initially raised this without doing much investigation hence my follow up with issue #8

I have not done any npm packaging as yet and I am certainly no expert but renaming roughviz.min.js to index.js does indeed resolve the issue for me.

You would need to confirm this resolves the issue for you as the contents of the original index.js looks build related so double check nothing wipes out your change following a build :)

MintyMods avatar Oct 22 '19 17:10 MintyMods

The file rough-viz.min.js is commited and checked into git https://github.com/jwilber/roughViz/blob/master/dist/rough-viz.min.js

It looks like your build script (parcel) creates an UMD (for browsers) and a nodejs/commonjs version (that it can be require'd) https://github.com/jwilber/roughViz/blob/master/package.json#L7-L10

parcel creates roughviz.min.js (without the dash -) and index.js (I think), but non of them create rough-viz.min.js

fyi you should consider having a module field that points directly to the source, so people can import es modules directly.

can you double check that the file dist/rough-viz.min.js isn't generated

thisconnect avatar Nov 29 '19 11:11 thisconnect

@MintyMods it's been a while since your comment, but I've tried renaming rough-viz.min.js as well as roughViz.min.js (both are still generated) to index.js, but I am consistently getting the error you mentioned in #8

Uncaught TypeError: Cannot read property 'ownerDocument' of null

Have you worked with this recently and have any idea how I might resolve this? It might be worth mentioning that I am using svelte-kit, which is still in beta phase.

vcheeze avatar Jul 01 '21 19:07 vcheeze

Nevermind this seems to be an issue with svelte-kit. Tried with Sapper (predecessor of svelte-kit), and it works. Thanks!

vcheeze avatar Jul 01 '21 19:07 vcheeze

Hi @vcheeze,

To be honest I kinda put my project on hold to allow Svelte to mature a little more while I worked on something else but I do love the concept of Svelte and have been meaning to get back into my project with hopefully a little more time to investigate and contribute to some of the issues that I originally hit.

I was literally typing to offer help but just seen your update ;o)

Glad you resolved the issue my friend.

MintyMods avatar Jul 01 '21 19:07 MintyMods

Cleaned this up (years later 🐌 ) with V2. Can import ESM via import roughViz from "rough-viz";

jwilber avatar Oct 01 '23 04:10 jwilber