Closed ghost closed 10 months ago
Discussion around this issue can be found on discord. Issue verified by Dreyfus
same here preview and server options are not working
import sitemap from '@astrojs/sitemap';
import { defineConfig } from 'astro/config';
import { loadEnv } from 'vite';
const environment = loadEnv(process.env.NODE_ENV ?? 'development', './src/global/env', '');
export default defineConfig({
build:
{
assetsPrefix: process.env.NODE_ENV === 'production' ? environment.BASE_URL : undefined,
inlineStylesheets: 'never'
},
integrations: [ sitemap() ],
site: environment.BASE_URL,
vite:
{
envDir: './src/global/env',
preview:
{
host: true,
open: true
},
server:
{
host: true,
open: true
}
}
});
Here is the repo for reproduction Astro template
> strong-star@0.0.1 astro
> astro info
Astro v4.1.2
Node v18.16.1
System Windows (x64)
Package Manager npm
Output server
Adapter @astrojs/node
Integrations @astrojs/tailwind
> strong-star@0.0.1 astro
> astro dev --host
astro v4.1.2 ready in 427 ms
┃ Local http://localhost:4321/
┃ Network http://172.17.112.1:4321/
http://192.168.45.1:4321/
http://192.168.249.1:4321/
http://10.25.94.237:4321/
Running node 18 here — since it's windows, maybe a UAC issue?
I can't replicate the issue, although the script works when using npm run dev -- --host
. Using npm run dev --host
won't work.
@ematipico and using the astro config file works for you ?
@ematipico and using the astro config file works for you ?
If you mean vite.server.host
, no, it doesn't. Although I think should be a separate issue.
in that case i will open other issue
I'm not using Vite (or anything similar) though. This is my config:
import { defineConfig } from 'astro/config';
import tailwind from "@astrojs/tailwind";
// https://astro.build/config
export default defineConfig({
integrations: [tailwind()]
});
Astro v4.2.3
Node v21.5.0
System Windows (x64)
Package Manager npm
Output static
Adapter none
Integrations @astrojs/tailwind
Updated to v4.2.3, issue still occurring. Tried to make a reproducible instance with Stackblitz but I think it's set to disallow --host
.
Thanks.
npm run dev -- --host
did the trick for me 🚀
Thanks.
npm run dev -- --host
did the trick for me 🚀
Yeah if you miss the first --
you are passing the --host
to npm rather than the astro command that is behind run dev
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When I run
npm run dev -- --host
(ornpm run dev --host
), the development server is not exposed.What's the expected result?
I expect it to expose the development server to my network and output the IPs that it's on.
Link to Minimal Reproducible Example
Not applicable.
Participation