You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I helped a friend of mine to setup this template andI noticed a small problem with the way you manage the different environments :
Actually, when you're on the production build, you first try to fetch localhost, and if it fails, you then try to fetch the correct build deployed on Netlify. To me, this is a problem because you have to wait for the localhost request to time out before getting the correct bundle (which can be up to 4 seconds !).
What I suggest would be to have two environements files (dev and prod) with the same variables declared but with the correct values according to the env (the main.js absolute urls) . You would then use the dev env file by default when developing, and swap it with the prod env file on build time, with the help of yarn build.
Of course, instead of files, you could just use a variable framed by an if :
Hi, and first of all, thank you for your work !
I helped a friend of mine to setup this template andI noticed a small problem with the way you manage the different environments :
Actually, when you're on the production build, you first try to fetch localhost, and if it fails, you then try to fetch the correct build deployed on Netlify. To me, this is a problem because you have to wait for the localhost request to time out before getting the correct bundle (which can be up to 4 seconds !).
What I suggest would be to have two environements files (dev and prod) with the same variables declared but with the correct values according to the env (the
main.js
absolute urls) . You would then use the dev env file by default when developing, and swap it with the prod env file on build time, with the help ofyarn build
.Of course, instead of files, you could just use a variable framed by an
if
:What do you think ?
The text was updated successfully, but these errors were encountered: