Closed lakano closed 3 years ago
That's indeed a lot. Is it during development or production? Can you link to the example you are using?
It should be more like the following examples:
It's during development with SSR mode, but I've not tried to upload it. I've pushed my code here: https://github.com/lakano/cf-tests
I'll test to deploy it, it's may be better in production, but there is a way to see/simulate exactly the same content/sizes than it will be in production ? ( some kind of --production flag )
@lakano Ah no, there's no development mode to simulate production because the magic of Vite is precisely that, it skips bundling during dev to speed it up.
It would be possible to have some kind of build watch and refresh outside Vite, and I'd like to combine this with Wrangler so it directly runs development in a CF worker. But that needs to wait until https://github.com/frandiox/vitedge/pull/22 is finished.
( I'll create another issue ticket about my 2nd problem with Wrangler )
About the file size, I'll try to upload it to compare, but after a "vitedge build", do we need to add some packages in the dist/ssr/package.json and to run a "npm install" ?
@lakano No, adding dependencies to the dist files shouldn't be necessary if your project folder structure is similar to the starter template.
Right now, Vite is not bundling all the dependencies for the SSR build because it is meant to be for Node environment (more info here).
However, CF worker needs everything bundled. That's where Wrangler's Webpack build helps. However, for this to work your worker-site
and dist
folder should be direct children of the folder that has your node_modules
.
Therefore, even though vitedge build
is not bundling all the deps (due to Vite's behavior), wrangler dev
or wrangler publish
should do the rest.
Again, this should all be simpler once custom builds are available since it will be able to bundle everything without using Webpack.
@lakano Did you have time to test this in prod?
Hello,
I don't known if this is expected, but just following the documentation sample for the Hello World + counter, and on the first load there is 1,59MB to download, it's a lot for a so small part of code, and impact SEO performances.
Do you known what cause theses files sizes ?![Photo of assets files sizes](https://user-images.githubusercontent.com/731955/116313754-755b5500-a7ae-11eb-9f6b-dfd9eb33e68b.png)