Disable /public folder generation inside Android app

Hello guys.
I have a project that I want to serve remotely from a server, in an Android app. So what I’m doing right now is generating a build, uploading the contents of /www/ to my server, and then I added the URL to capacitor.config.ts:

const baseConfig: CapacitorConfig = {
	...
	server: {
		url: "https://mysite.com"
	}
}

This works perfectly, but now my problem is that everytime I compile the project, the source code is still being generated in android/app/src/main/assets/public. How can I disable this?

Thanks a lot.

So something to keep in mind is that app store will probably not approve your app if you do this. Your app should contain all the code needed to function in the binary. Pointing to a remote server will likely cause your app to no work at all if there is no network.

To better answer your question though… I would change you webDir entry to point to an empty folder or something else.

So something to keep in mind is that app store will probably not approve your app if you do this. Your app should contain all the code needed to function in the binary. Pointing to a remote server will likely cause your app to no work at all if there is no network.

Thank you for the heads up, we’ll have those limitations in mind.

To better answer your question though… I would change you webDir entry to point to an empty folder or something else.

Perfect. I pointed webDir to a different directory and it looks like the compiled files aren’t added to my Android project anymore. Thanks.

Sorry, I had a mess in my configuration file. I had a variable with the configuration for dev, and another variable for prod, and I was always exporting the wrong one.

To sum it up, if it helps anyone:
@mhartington was right about pointing webDir to an empty directory, however, the directory has to have an index.html file. Otherwise it won’t compile.