react-inspector icon indicating copy to clipboard operation
react-inspector copied to clipboard

Please include webpack output in NPM distribution

Open feldgendler opened this issue 7 years ago • 9 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?

feldgendler avatar Jul 11 '17 14:07 feldgendler

Sounds reasonable to me.

ndelangen avatar Jul 11 '17 19:07 ndelangen

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.

kumarabhishek avatar Jul 22 '17 14:07 kumarabhishek

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 avatar Jul 22 '17 21:07 feldgendler

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

ndelangen avatar Jul 25 '17 20:07 ndelangen

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 avatar Jul 25 '17 20:07 feldgendler

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

feldgendler avatar Jul 25 '17 20:07 feldgendler

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 avatar Dec 31 '17 20:12 billiegoose

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

billiegoose avatar Jan 01 '18 04:01 billiegoose

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

ndelangen avatar Jan 01 '18 10:01 ndelangen