function ensureConfigEnvironmentMainFields(name, config, opts) {
	config.resolve ??= {};
	if (config.resolve.mainFields == null) {
		if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) {
			config.resolve.mainFields = [...defaultClientMainFields];
		} else {
			config.resolve.mainFields = [...defaultServerMainFields];
		}
	}
	return true;
}
Mutates `config` to ensure `resolve.mainFields` is set. If unset, it emulates Vite's default fallback.
@param {string} name
@param {import('vite').EnvironmentOptions} config
@param {{ isSsrTargetWebworker?: boolean }} opts