Commit 4f06150
committed
Skip emitFile() in astro:scripts plugin during serve mode
Guard the buildStart hook in vite-plugin-scripts to skip this.emitFile()
when Vite is running in serve mode. emitFile() is a Rollup build-time API
that Vite stubs out during dev, producing a spurious warning:
[WARN] [vite] [plugin:astro:scripts] context method emitFile() is not
supported in serve mode.
The fix captures the Vite command via the config hook and returns early
from buildStart when command === 'serve'.
Fixes #16026
Fixes #159751 parent b089b90 commit 4f06150
2 files changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
0 commit comments