TypeError: Failed to fetch


The above code works fine in development mode. When I build the project it gives a CORS error.

NOTE: I open index.html as “file:///Users/…”

Exactly as the error says, “Cross origin requests are only supported for protocol schemes…”. i.e. file:// is not supported