You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create / Configure a vite.config.ts file in your project root.
import{loadEnv,defineConfig}from'vite'import{ngrok}from'vite-plugin-ngrok'exportdefaultdefineConfig({// Note you should not store your ngrok token in your code/repo. Make sure to move this to // a more secure place before sharing your project.plugins: [ngrok('NGROK_AUTH_TOKEN_IN_HERE'),],})
Fire up Vite as usual
npm run dev
Configuration
The ngrok plugin can be configured in 3 ways.
No configuration. This will default to automatically use the vite port and authtoken_from_env will be set to true. This will look for NGROK_AUTHTOKEN in your environmental variables.
ngrok()
If given a string the plugin will assume this is your auth token and configure it automatically with the vite port.
ngrok('NGROK_AUTH_TOKEN_IN_HERE'),
Full ngrok config. If given an object you can pass in any options from the ngrok config. This will be merged with the default port from vite so that does not need to be set. Config properties can be found in the ngrok Javascript SDK Config docs