Firebase hosting is making my js bundle size go to 4.5mb - firebase-hosting

I have the following pictures of my storage window compare to my build folder
the issue is some answers regarding similar cases, here on stack, say that firebase compresses your bundle before sending to client, in my case it is tripling the size of my js bundle, is this an issue in fire store on at my end , I am building my react app using this script ,
"winBuild": "set "GENERATE_SOURCEMAP=false" && react-scripts build"
npm run winBuild
and then
firestore deploy --only hosting
when I delete those to files from cache my cache storage goes from 6mb to 1.5 .. 2 js files 4.5mb is kind of weird.
my site was deployed to heroku and I was serving using node.js express and compress middle ware and didn't have this problem.

Related

Upload image error -> blob:http://localhost:3000/48c7da66-42c0-4ed3-8691-2dedd5ce4984:1 Failed to load resource: net::ERR_FILE_NOT_FOUND [duplicate]

I build a MERN app and hosted on heroku.
I saved the user's images on server by multer and it works fine for some time i.e. uploaded image is fetched successfully.
But after closing the application for long that image is not available on server.
On searching I found that each dyno on heroku boots with a clean copy of the filesystem from the most recent deploy.
But then how and where to save images?
Dyno file system is ephemeral so you need to store the file on an external storage (ie S3, Dropbox) or use an Heroku plugin (ie for FTP).
Check Files on Heroku to understand (free) options for storing/managing files (the examples are in Python but the concept is valid for other stacks too).

Migrate ionic app in a server as a website

I have an ionic app that is connected to the mySQL database from a server and I want to migrate this app to the same server. I want to use this application as a website, which will continue to extract data from the mySQL database. How can I do that?
Thank you.
First I think you should probably split this into two projects:
the Ionic app, which communicates with the server via the API
the server side API (PHP file) with connection to the database
Usually these two would be in separate (Git) repositories.
You can then execute ionic build --prod to build the Ionic app for the web. The deployable files will be in the www directory once the command has finished. You can copy the files in this directory to a webserver like Apache or nginx, or you can easily deploy it to Firebase Hosting for example as well. It's just static files (HTML, CSS, JS, images, etc.).
You can find more information about deploying an Ionic app as a PWA (progressive web app) here. It also shows you how to deploy to Firebase Hosting, which has a free plan to get started with.

Using Firebase's reserved hosted URLs for local flutter development

I'm developing an app in flutter and deploying it to Firebase hosting.
Firebase hosting and the firebase serve command for local development let you initialize Firebase from a special auto-generated relative URL (/__/firebase/init.js).
This is nice because it allows me to share my project (on github, for example) without including my Firebase configuration.
Sadly, this does not seem to play nice with flutter run -- if I use flutter run, I lose the special URLs, and if I use firebase serve, I lose flutter's hot reload features.
My current workaround is to have the following local files under my app/web/ directory:
__/firebase/init.js # containing firebase.initializeApp(myFirebaseConfig);
__/firebase/7.1.44/firebase-app.js # manually downloaded from the gstatic cdn
__/firebase/7.1.44/firebase-auth.js
# ... (etc)
This works, but:
The __ directory actually gets deployed to Firebase. (Not actually a problem, but it seems wrong)
It's annoying to set this up manually in each local development environment.
Ideally, one should be able to firebase login, firebase init, and then flutter serve, and then automagically have access to the /__/ directory.
Is there already some way to make this happen, and if not, how could we implement it?
(For example, is there a way to extend flutter's local http server to take advantage of the logic that's already in the firebase-tools npm module?)

Deploying ionic 4 website to digitaloceans spaces CDN

I'm trying to deploy a basic ionic 4 application to spaces CDN provided by digitalocean.
I uploaded the static website on gitlabpages and the website is working.
I've tried to replicate the results on spaces CDN but the file instead of being opened by the browser get downloaded once opened.
I figured out it could be the --base-href, and I tried to modify it, but without success, the index file provided by the build still get downloaded
At first I build the ionic app
ionic build --prod --base-href="xxx.gitlab.io/xxx" //code used to deploy for gitlab pages
Then for gitlab pages I deployed it using gitlab-ci.yml file, as explained here, while for deploying on spaces I used a python script
I would expect to be able to upload an ionic build into spaces CDN and being able using the link provided to see the website.
I'm not sure if I'm doing something wrong at conceptual level using a CDN, it is actually my first time trying to serve a website using this tech.
UPDATE
I've uploaded to the CDN again, and I realized that if I use the origin link, it actually load the html (even tho it gives me a lot of errors).
While is I use the CDN link, it try to download the file.
I have purged the cache of the CDN so in my opinion the CDN and the origin should behave exactly the same, Am I wrong?

Why does the command 'meteor deploy' upload so much data?

$ meteor --version
Meteor 0.9.4
$ meteor create todos
$ cd todos
$ meteor deploy blah
Uploading...
[= ] 7% 484.0s Uploading
It takes 8 minutes because it uploads a 30Mb file.
I think I understand the reason for the large files, /local contains a local database, but why is this data being uploaded for each deployment?
My actual app is closer to 70Mb (immediately after running meteor reset) and typically I don't have access to fast upload bandwidth so it would help to reduce the spread of my grey hair if someone knew how to speed things up.
When meteor bundles your app it takes your code (which are the files you see in your project) and creates a nodejs bundle with all the meteor code in it too.
The meteor code is the framework itself and nodejs modules & its quite big. This is what is then uploaded to the meteor deploy server.