storybookjs / react-inspector

🔍 Power of Browser DevTools inspectors right inside your React app

Home Page:https://5d8cb665bc622e0020296079-dippbxxgcq.chromatic.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please include webpack output in NPM distribution

feldgendler opened this issue · comments

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?

Sounds reasonable to me.

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.

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).

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

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.

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

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.

@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.

@wmhilton I would be happy to accept a PR.

It should:

  • adding a build step that generates this file
  • ignore this file for git
  • add the file to npm
  • add a section to the readme abou usage

Would love to see that PR 🙇