carteb / carte-blanche

An isolated development space with integrated fuzz testing for your components. See them individually, explore them in different states and quickly and confidently develop them.
https://www.youtube.com/watch?v=6g3-TQ6aaw8
MIT License
1.5k stars 47 forks source link

`dest` option does not work with prefixes #304

Open wmertens opened 8 years ago

wmertens commented 8 years ago

Our webpack assets are generally under /_assets so that they don't interfere with HTML5 URL rewrites.

This means that the http://.../carte-blanche url is really at http://.../_assets/carte-blanche. Carte Blanche refers to its assets by absolute path, so that doesn't work. Specifying a dest option just replaces the carte-blanche part, not the prefix.

IMHO, assets should be loaded without path, since they will be in the same location as the index.html file.

wmertens commented 8 years ago

Another option would be to also include the configured public path into the url…

mxstbr commented 8 years ago

IMHO, assets should be loaded without path, since they will be in the same location as the index.html file.

We had that, but the problem then is that you have to go to /dest/ (notice the trailing slash), otherwise the assets will refer to the root domain. I'm about 99% sure that we'd get tons of bug reports about that, so I fixed it by prepending the dest option.

Another option would be to also include the configured public path into the url…

That sounds a lot more reasonable. :+1: Shouldn't be too hard either, we have to pass it to the ReactPlugin frontend.js and then merge the dest option with the public path.

wmertens commented 8 years ago

The trailing / could be fixed by passing staticOptions: {redirect: true} to the webpack-dev-server.

Also, a bit of javascript before the main js loading could check for the url matching /(index.html)?and if not, redirecting.