Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π Linked issue
nuxt/test-utils#537
nuxt/test-utils#1043
β Type of change
Hi π
This PR fix an issue with presets and will allow multiple Nuxt to be ran within the same process (like for vitest workspaces or its vscode extension)
Linked issues above are trying to run multiple nuxt at the same time. It means we need also to be able to start multiple nitro.
Here's the race condition.
Presets are objects and
nitro/src/core/config/loader.ts
Line 141 in e8d6099
returns directly the reference of the preset.
If we load 2 nitro at the same time, C12 can delete _layers on the preset object
https://github.com/unjs/c12/blob/67cf916ca727e584390196ce3d3bfb76aa102ec1/src/loader.ts#L267
and the other other may need _layer at that time (calling .push() for example) which will fail and throw an error.
(will this pr be merge in nitro 2 or does it need another pr ? )
π Description
π Checklist