reactjsoauthvite

How make the vite react app run on http://localhost:3000 insted of http://127.0.0.1:5173


Im trying to use google oauth with my vite react app but i dont know why the Authorized JavaScript origins is not working if i give http://127.0.0.1:5173 as the URIs but its working for http://localhost:3000 so i want to make my vite react app run on http://localhost:3000 insted of http://127.0.0.1:5173 when i type npm run dev and press o (to open the page on browser).

I even tried to make some changes to the vite.config.js but still not working below is the code

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  server: {
    host: "localhost",
    port: 3000,
  },
});

In package.json file this is the change that i have made in package.json file

someone please help me with this.

Tried this


Solution

  • vite.config.ts

    import dns from 'dns';
    
    // localhost part
    dns.setDefaultResultOrder('verbatim');
    
    export default defineConfig({
      server: {
        port: 3000,
      },
    });