Skip to content

Commit

Permalink
fix: dev restart error while build
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Jan 5, 2023
1 parent 8d0a8f0 commit 617fcb1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion playground/spa/public/a.d43b8524.js

This file was deleted.

Empty file.
2 changes: 1 addition & 1 deletion playground/spa/publicTypescript/manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"a": "/a.d43b8524.js",
"a": "/a.e3b0c442.js",
"spa": "/spa.d43b8524.js"
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path'
import type { ResolvedConfig, PluginOption } from 'vite'
import type { PluginOption, ResolvedConfig } from 'vite'
import { normalizePath } from 'vite'
import fg from 'fast-glob'
import type { BuildOptions } from 'esbuild'
Expand Down
4 changes: 3 additions & 1 deletion src/utils/manifestCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export class ManifestCache {
.sort()
.forEach((k) => (orderdCache[k] = cacheObj[k]))
await fs.ensureDir(path.dirname(targetPath))
await fs.writeFile(targetPath, crlf(`${JSON.stringify(orderdCache, null, 2)}`))
if (Object.keys(orderdCache).length) {
await fs.writeFile(targetPath, crlf(`${JSON.stringify(orderdCache, null, 2)}`))
}
}
}

0 comments on commit 617fcb1

Please sign in to comment.