-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
feat: integrate with Vite Task for zero-config build caching #22453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
501eb5d
16ffb63
2cb26e4
eede8a7
9e73068
f974668
8bf4167
877e87d
fe81445
5b54e07
4e511f6
ea9bbe8
7119ea3
23ded7b
f23d916
bdf9921
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import fs from 'node:fs' | ||
| import path from 'node:path' | ||
| import { ignoreInput } from '@voidzero-dev/vite-task-client' | ||
| import colors from 'picocolors' | ||
| import type { Plugin } from '../plugin' | ||
| import { getResolvedOutDirs, resolveEmptyOutDir } from '../watch' | ||
|
|
@@ -51,6 +52,11 @@ function prepareOutDir( | |
| const { publicDir } = environment.config | ||
| const outDirsArray = [...outDirs] | ||
| for (const outDir of outDirs) { | ||
| // When run inside Vite Task, `emptyDir` below reads the entries of | ||
| // `outDir`. Without this, those reads would be recorded as build inputs | ||
| // and mix with the writes that follow, tripping Vite Task's read-write | ||
| // overlap check. | ||
| ignoreInput(outDir) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Effect verified in |
||
| if (emptyOutDir !== false && fs.existsSync(outDir)) { | ||
| // skip those other outDirs which are nested in current outDir | ||
| const skipDirs = outDirsArray | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ import colors from 'picocolors' | |
| import chokidar from 'chokidar' | ||
| import launchEditorMiddleware from 'launch-editor-middleware' | ||
| import { determineAgent } from '@vercel/detect-agent' | ||
| import { disableCache } from '@voidzero-dev/vite-task-client' | ||
| import type { SourceMap } from 'rolldown' | ||
| import type { ModuleRunner } from 'vite/module-runner' | ||
| import type { FSWatcher, WatchOptions } from '#dep-types/chokidar' | ||
|
|
@@ -483,6 +484,10 @@ export async function _createServer( | |
| previousForceOptimizeOnRestart?: boolean | ||
| }, | ||
| ): Promise<ViteDevServer> { | ||
| // The dev server is a long-running, interactive process whose outputs | ||
| // (network responses, HMR updates) cannot be replayed from a cache. | ||
| disableCache() | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Effect verified in
wan9chi marked this conversation as resolved.
|
||
|
|
||
| const config = isResolvedConfig(inlineConfig) | ||
| ? inlineConfig | ||
| : await resolveConfig(inlineConfig, 'serve') | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.