How can I get and use app context root for a reactjs app at run time - facebook

I do not know what the public path of my reactjs app will be during build time. Is there a way I can get and use the context path at run time?
My app is created with the create-react-app script from facebook. I can use the "homepage":"/some-context-root" flag in package.json. The only problem is I do not know this during build time and more likely it will not be the root folder of my http server.

Related

Publish with new update

I created a project in Flutter Web + Lazy Loading.
After updating project I'm running: Flutter Build Web
Then I put the project in the service of Vercel.
When I access the site I noticed that it is not downloading the new updates and generating blank pages when closing the site and opens again works.
Do I need to define the new version somewhere in the project and run: Flutter Build Web and post again to avoid this problem again?
By accessing the site all files are downloaded again by preventing the cache from undermining the user experience.

Multi Vendor Flutter

I want to make an Flutter application through this application. You can choose a specific theme and make several modifications to it to suit you, but when you are finished, you can make an APK version of this theme from within the application itself. The question is how can I do the APK process from within the application itself to lead me to another separate application About the original app
What you can do is passing all the related details to a backend server and let the server build the APK instead. The user can download the APK once it is ready.

How to deploy Flutter Web to my own server?

I've just created a flutter web application and now I am ready to deploy it. Looking at the docs it looks like I need to use Firebase Hosting? But I want to host the app on my own server. I tried copying the web directory from Build but when I go to the path I get a blank screen on web. How do I deploy it correctly? Or is it just simply not possible without Firebase?
First you need to compile the application.
In a terminal, command prompt or Powershell, go to the root directory of your project.
From there run a build:
flutter build web
This will create a new directory inside your project.
c:\your-project-folder\build\web
Copy everything that is in the web folder to wherever you want to publish / host your application.
Your application is bundled up into a main.dart.js file.
An index.html is also in that directory. You should be able to run your Flutter web app by visiting that index.html.
All the instructions for building a Flutter application for web platform is here.

How do I build an Ionic 4 app to run in a folder?

When I build my Ionic 4 app, it presumes to run at the root of the domain. It puts <base href="/" /> in the Index.html, and so all subsequent requests target the root of the domain. I can make it work in a folder by changing the base to <base href="." />, but a little voice tells me I shouldn't be modifying a generated file.
Where is the configuration variable to let me run my app from a folder if I want to? Do I need to know the name of the folder at build time?
You can just go ionic serve in any folder and it will serve your application. If you mean in an production environment you'd run ionic cordova build <platform> and it'll generate the .apk if you specified the android environment or it will generate an XCode project if you specified iOS.
I am however unsure which platform you are building for. So your results may vary if you're building for the browser platform.
Hope I understood your question correctly.

ionic 3 publish app as PWA (Progressive Web App)

I want to publish my app as PWA so what i did is
insert this script to index.html
<!--script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js')
.then(() => console.log('service worker installed'))
.catch(err => console.log('Error', err));
}
</script-->
then install
npm run ionic:build --prod
it looks like it deploy it but my questions are:
what files I need to upload to host for publish the app as PWA?
why when I change something in the app and run ionic serve nothing changed and it changed only in the index.html of the WWW folder? why?(because now it's PWA??)
when I open www folder and I run open index.html when i press on button that open alert dialog it not open that. why?
when I run the command? only in the end of development?
Run
ionic cordova platform add browser
ionic build browser --prod --release
Then go to [project_folder]/platforms/browser/www and copy the content at you http server.
Don't bother with Cordova for a PWA. Just use npm run build --prod and upload the /www folder.
PWA is more of a collection of concepts, so it's not just "on" or "off". At a minimum though you probably want to add a manifest file so you can make it more "app like" by hiding the browser frame, setting your icon, app name etc. Uncommenting the line to add service worker doesn't magically make it a PWA if you haven't put anything "useful" into service worker (which you may or may not need to do, depending on how your app works). Also note that you will need HTTPS to use a service worker.
You will also need to manually remove the line from index.html that includes cordova.js (which will be a 404 error if you just upload /www).
I use this command for building web app
ionic cordova build browser
Then copy the contents from IONIC-PROJECT/platforms/browser/www to the web server.