ReactJS routing/browser-sync reload on /path produces Cannot Get /Path error -
i'm building basic react/flux application , using react-router-component routing, browser-sync live reload on build changes, , browserify dependency injection.
the problem have when live reload or reload occurs on path isn't "/" (i.e. "/profile", "/gallery", etc...), error message of cannot /path (or route matter).
i suspect has fact it's single page application , routing done on client.
here browser-sync setup (it's basic). think might need add middleware, i'm not sure put in middleware.
gulp.task('browser-sync', function() { browsersync({ server: { basedir: './client' }, notify: false }); });
this because whatever web server you're using serve out app trying find /profile or /gallery on server side. need instruct server requests goes root instead. depending on software called 'html 5 mode'.
i noticed there's post on browser-sync git repo possible solutions here: https://github.com/shakyshane/browser-sync/issues/204
but basic idea make server send isn't *.js or *.css ./index.html (assuming app's entry-point file). way server doesn't routes itself, , loads app free parse them correctly on client-side.
hope helps.
Comments
Post a Comment