I've been trying to figure this out on my own for a while, but I cannot seem to find the right configuration. I have a few images I want to serve as part of my demo application both when developing (using nwb serve) and when building a demo distribution (nwb build) for my React Component library. Is there an easy way to configure this?
The easiest thing is probably to just import them so webpack will handle them:
<img src={require('./image.jpg')}/>
Does this work for what you're trying to do?
Alternatively if there are some static files you just want to get served and copied when building, you can create a demo/public/ directory and put them there.
wow, did NOT know about that, but in retrospect I guess I should have.
Thanks for the the tip and the AWESOME tool! Sorry for polluting the issues here with such a dumb question :P
It's not a dumb question if you know about it, seems like we should have a couple of paragraphs in the docs to point out how you use static resources in Webpack/how webpack builds a graph of assets.
Which docs did you refer to? There are a couple of places this info should probably go.
Cool, I was looking in and around the webpack configuration. Primarily around the devServer here https://github.com/insin/nwb/blob/master/docs/Configuration.md#devserver-object
I also followed links through to webpack and express and was trying to configure express directly to serve from a static folder. Not entirely sure where it should go though, maybe somewhere around the webpack loaders?
Most helpful comment
It's not a dumb question if you know about it, seems like we should have a couple of paragraphs in the docs to point out how you use static resources in Webpack/how webpack builds a graph of assets.
Which docs did you refer to? There are a couple of places this info should probably go.