Reputation: 753
I have successfully deployed a SolidJS app to netlify just fine, but I ran into an issue where additional routes other than /
cause the app to crash. Having previously deployed React apps to Netlify, adding a _redirects
in the public folder works fine, but I'm not exactly sure where I should in my project directory the file should go since my local SolidJS project has to public
folder. I tried adding a dist
folder under my client
folder, but that didn't resolve the issue.
Is there any solution to this unique to SolidJS? Is a _redirects
file the right way to go?
Upvotes: 2
Views: 430
Reputation: 55
I guess your problem is you created a app with Solids basic router. I fixed it by adding a plain _redirects file to the dist folder (without any extension) and adding the following line to it:
/* /index.html 200
By doing that my Solid router config in App.js works as expected. For example the default "followed a broken link or url" from netlify doesn't appear anymore and it takes my defined routes:
<Router root={App}>
<Route path={"/"} component={Login}/>
//other defined routes
<Route path={"*"} component={_404}/>
</Router>
Don't forget to explicitly add it to the dist folder otherwise it won't work. I prefer manual deploys on netlify so if you use GitHub make sure it's not missing!
Upvotes: 0
Reputation: 3
As per Netlify redirects routing docs, there are two ways to implement this. Given you can't do it the first way, perhaps the second one would be your workaround:
Add one or more redirects tables to your Netlify configuration file. This method allows for more structured configuration and additional capabilities, as described in the Netlify configuration file syntax section below.
Hope this helps.
Upvotes: 0