Do you want to request a _feature_ or report a _bug_?
Bug / Documentation fix
What is the current behaviour?
Using the example proxy code breaks the single page app feature.
If the example proxy code is used then when navigating directly to anywhere but the route the SPA will not be served to you. These pages still work when you go to them via a link on the home page.
If the current behaviour is a bug, please provide the steps to reproduce.
preact create default with all default settingscd app npm run devlocalhost:8080/profilepreact.config.js and add the following from the config recipesjs
export default (config, env, helpers) => {
config.devServer = {
quiet: true,
proxy: [
{
path: '/api/**',
target: 'http://api.example.com',
// ...any other stuff...
}
]
}
}
Ctrl-C and npm run devlocalhost:8080/profile again to show that SPA is brokenCannot GET /profile
What is the expected behaviour?
Please mention other relevant information.
Changing the example to this would avoid overwriting the other devServer settings. Which would stop the example code breaking stuff and help avoid confusion.
export default (config, env, helpers) => {
config.devServer['proxy'] = [
{
path:'/api/**',
target: 'http://api.example.com',
// ...any other stuff...
}
]
}
It looks like this is what used to be in the wiki, but it was changed at some point
https://github.com/preactjs/preact-cli/wiki/Config-Recipes/_compare/01a18e56a6e613a273c0d654c25b6bd104758003...a404dae65d956422f84fa7a984c5a07a2590a59c#diff-1e29ab5c585666f64d9aef04f7ae9e33L49
no idea why it was changed, the old one was correct
Changed it back