jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.28k stars 507 forks source link

A way to run local development server #701

Closed dfsa-bot closed 4 years ago

dfsa-bot commented 4 years ago

Current Behavior

There's currently no easy way to run local development server

Desired Behavior

I'd like tsdx to have an option to run local development server

Suggested Solution

I was exploring some custom rollup config utilising https://github.com/thgh/rollup-plugin-livereload and https://github.com/thgh/rollup-plugin-serve but didn't have much luck with that.

Who does this impact? Who is this for?

It's a nice-to-have feature. I would most def. find this usefull. Let's say I am building another react-awesome-table lib, which is basically a react component someone would feed with data in order to get this data being displayed in a table - I need local development to test all the use cases

Describe alternatives you've considered

What I've done so far was to use the 'example' folder with its' parcel dev server. If I am not mistaken, this is not the perfect way to do such thing as running dev server.

agilgur5 commented 4 years ago

I think you're mistaken about the use-case here. Your library doesn't have a public/ dir or an index.html or a ReactDOM.render call, your library is just a component. I'm not totally sure how those plugins you've referenced work, but I'm pretty sure the lack of at least one of those is the problem with using them.

An example or a Storybook would have a ReactDOM.render call and would instantiate your component somewhere, so that is indeed the right place to render and visualize you component. Testing should normally be done with tsdx test with Jest unit tests or Storyshots though.