Skip to content
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

fix: normalize config.root #443

Merged
merged 5 commits into from
Dec 3, 2023
Merged

fix: normalize config.root #443

merged 5 commits into from
Dec 3, 2023

Conversation

kumv-net
Copy link
Contributor

c2440d46ed9f4b1f2fd740dfe862f10

Invalid sorting of type file generation, resulting in unnecessary git versions
Reading DTS file is empty while writing the file is incomplete

vite

Debugger attached.
环境变量 VITE_DROP_CONSOLE undefined
configResolved 《======= 【Trigger Event 1】
scanDirs writeConfigFilesThrottled
writeConfigFiles
readFile Ing 1700340039378 《======= 【Trigger Event 1 readFile Ing】
originalContent:/* eslint-disable /
/
prettier-ignore /
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const $: typeof import('vue/macros')['$']
const $$: typeof import('vue/macros')['$$']
const $computed: typeof import('vue/macros')['$c 1700340039385
content !== lastDTS writeFile true
buildStart 《======= 【Trigger Event 2】
scanDirs writeConfigFilesThrottled
writeConfigFiles
readFile Ing 1700340039970 《======= 【Trigger Event 2 readFile Ing】
writeFile ing : 《======= 【Trigger Event 1 writeFile Ing】
E:\hby\project*
*\packages\vite-vue3-admin-main\auto-imports.d.ts
/
eslint-disable /
/
prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const $: typeof import('vue/macros')['$']
const $$: typeof import('vue/macros')['$$']
const $computed: typeof import('vue/macros')['$c 1700340039988

VITE v4.5.0 ready in 7238 ms

➜ Local: http://localhost:8088/
➜ Network: http://198.18.0.1:8088/
➜ Network: http://192.168.110.110:8088/
➜ press h to show help
originalContent: 1700340040095 《======= 【Trigger Event 2 readFile End content empty】
content !== lastDTS writeFile false
writeFile end : 1700340040098 《======= 【Trigger Event 1 writeFile End】
writeFile ing :
E:\hby\project**\packages\vite-vue3-admin-main\auto-imports.d.ts
/* eslint-disable /
/
prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const $$: typeof import('vue/macros')['$$']
const $: typeof import('vue/macros')['$']
const $computed: typeof import('vue/macros')['$c 1700340040104
writeFile end : 1700340040115

It was found that the configResolved event triggered writing to the file while the buildStart event triggered it

Vite related pr
vitejs/vite#1693

fea7d33124812fd4a4a5bcf5b2186c3
Can also read file locks

Copy link

stackblitz bot commented Nov 19, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

src/core/ctx.ts Outdated

export function createContext(options: Options = {}, root = process.cwd()) {
root = isWindows ? slash(root) : root
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could always slash without checking with os

@antfu antfu changed the title fix: config.root for win32 fix: normalize config.root Dec 3, 2023
@antfu antfu merged commit 35d46e2 into unplugin:main Dec 3, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants