Skip to content

Commit 552763d

Browse files
committed
Allow Frontend To Be Hosted On Other Domain Names
The Vite configuration has been updated to use the `VITE_DOMAIN_NAME` environment variable for the host in both the server and preview sections. Now, if the `.env` file sets `VITE_DOMAIN_NAME=0.0.0.0`, the frontend will be exposed on all network interfaces. Signed-off-by: Tal Jacob <taljacob2@gmail.com>
1 parent 83ce4c8 commit 552763d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nextstep-frontend/vite.config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ dotenv.config();
99
export default defineConfig({
1010
plugins: [react()],
1111
server: {
12-
port: parseInt(process.env.VITE_PORT || '5000')
12+
port: parseInt(process.env.VITE_PORT || '5000'),
13+
host: process.env.VITE_DOMAIN_NAME || 'localhost'
1314
},
14-
preview: { port: parseInt(process.env.VITE_PORT || '5000') }
15+
preview: {
16+
port: parseInt(process.env.VITE_PORT || '5000'),
17+
host: process.env.VITE_DOMAIN_NAME || 'localhost'
18+
}
1519
})

0 commit comments

Comments
 (0)