You need to remove the following line from your Vite configuration file.
resolve: {
mainFields: ["browser"],
}
At least it should resolve the first console error Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.