jackcallister / react-bootstrap-slider

4 stars 2 forks source link

This is not a module #4

Open hu9o opened 9 years ago

hu9o commented 9 years ago

This project can't be npm installed as-is. I think it needs to go through UMD or similar. Advice is appreciated 😀

@jarsbe What do you think will suit best ?

jackcallister commented 9 years ago

@hu9o Good point! You should publish it :) I've added you as a collaborator so it's all yours! This is one of my oldest React components so it's not correctly set up. Here's my latest and the major stuff is in the webpack config. https://github.com/jarsbe/react-layer-cake/blob/master/webpack.config.js

Essentially a bundle is built but the React lib is excluded. You'll want a .npmignore file too. Check the repo above as that one is doing everything "correctly".

Feel free to push to master and make pull requests if you have questions or are unsure about anything. Good luck!

hu9o commented 9 years ago

It will help me figure out how to pack a module with webpack, thanks a lot 👍 So when I create a module, I should mention in webpack.config.js's "externals" all the libs I use ?

jackcallister commented 9 years ago

Yup that's the one! Details here - https://webpack.github.io/docs/library-and-externals.html

hu9o commented 9 years ago

I can't find a way to build a lib/module AND an example using that lib/module. Do I need to create a folder for the example with its own webpack configuration, and require the module from the parent dir ? Thanks!

jackcallister commented 9 years ago

Yeah you'll need to make an example dir and require the bundled file to make sure it works correctly and it'll have it's own webpack config. You can see that I'm doing a similar thing here https://github.com/jarsbe/component-boilerplate - the difference with my example is it's compiling the src file.

Have webpack bundle the /src file into a /lib dir. Then in examples dir require the bundle from lib to check it's all good before publishing.

Does that make sense?

Morriz commented 8 years ago

What is the status on this? I would like to use it as a module :)

hu9o commented 8 years ago

I forgot about it, and did not make much progress if I recall well...