swipeout icon indicating copy to clipboard operation
swipeout copied to clipboard

dist build is broken?

Open sherbondy opened this issue 7 years ago • 0 comments

Hi there,

I am trying to use the dist build of the swipeout component, but it seems like the build is broken!

Here's a minimal example in a codepen:

https://codepen.io/sherbondy/pen/jzKKrz?editors=1111

As you can see, both React and ReactDOM are available on the global window object, but the swipeout dist script is assigning an empty JavaScript object to window["rc-swipeout"].

Any idea what might be amiss?

I tried forking the repository and fiddling with the config in the package.json file.

I initially thought it might be a quirk with an older webpack version, so I tried bumping the rc-tools dependency to v7, but no go!

I also experimented with changing the config.output.libraryTarget setting, e.g. to be window instead of umd, but that causes the library to throw an error on import:

Uncaught TypeError: Cannot read property 'Component' of undefined

I'm a little out of my depth here, so if anyone has any pointers or ideas, re: what might be messing up the dist build, I would love to hear your advice!

Also, just an ergonomic thing, I think it'd be nicer if the config.output.library setting was changed to, e.g. Swipeout so you could call window.Swipeout instead of using the more awkward window["rc-swipeout"] syntax (due to the dash in the name).

Thanks!

sherbondy avatar Apr 03 '18 02:04 sherbondy