storybookjs / react-inspector

🔍 Power of Browser DevTools inspectors right inside your React app
https://5d8cb665bc622e0020296079-dippbxxgcq.chromatic.com/
MIT License
769 stars 95 forks source link

Please include webpack output in NPM distribution #37

Open feldgendler opened 7 years ago

feldgendler commented 7 years ago

Many other libraries include webpacked, minified single-file versions in their NPM distributions. React itself is one of the many such examples.

Can you please add that to the react-inspector NPM?

ndelangen commented 7 years ago

Sounds reasonable to me.

kumarabhishek commented 7 years ago

If your expectation is to have transpiled and minified single ES5 file then there is small drawback. For example in case you are not using DOMInspector in your code you won't import it in your app thereby including only code that is required and not everything. If we have single file then all code of library is included whether you want or not. Till we get tree-shaking correctly supported by webpack (which does not seems to work for ES6 component classes) we will not get any benefit by having single library file. So its always better to include to import what is required and keep emitted chunk size in control.

feldgendler commented 7 years ago

Yes, this is exactly what I expect, and I don't mind the file containing parts that I don't use. This is consistent with what happens when one uses a pre-packed React (which is even available on public CDNs that way).

ndelangen commented 7 years ago

@feldgendler Is it possible for you to submit a PR to add it? I'd suggest compiling to a dist folder using babel.

feldgendler commented 7 years ago

I started out by trying to produce a webpacked file myself, using “npm build”, but the resulting file caused errors in the browser (can't remember now what it was, looked like something internal to webpack). So I decided that I was doing something wrong, and that you probably know better how to do it.

feldgendler commented 7 years ago

I mean, I did that before I decided to file this bug.

billiegoose commented 6 years ago

I second this proposal. I don't have a React app... I just want to use this component to display data for a documentation site I'm making. Am hoping I can just import the UMD versions of React and this with script tags and get it to work somehow.

billiegoose commented 6 years ago

@feldgendler I bundled the object inspector into a standalone build and published it to the registry: https://npm.im/react-object-inspector-standalone

It's for those use cases where you aren't using React or Webpack, and want to just drop in a script tag and get something working quickly.

ndelangen commented 6 years ago

@wmhilton I would be happy to accept a PR.

It should:

Would love to see that PR 🙇