Pre-transform error: The requested module does not provide an export named 'withNuxt'
pending triage
### Environment
------------------------------
- Operating System: Darwin
- Node Version: v22.20.0
- Nuxt Version: 4.1.2
- CLI Version: 3.28.0
- Nitro Version: 2.12.6
- Package Manager: yarn@4.11.0
- Builder: -
- User Config: [...]
- Runtime Modules: @nuxt/eslint@1.15.1
- Build Modules: -
------------------------------
### Package
None
### Reproduction
I can provide a reproduction link if my description is not sufficient.
### Describe the bug
This error occurs when the nuxt eslint module is run for the first time with [checker option](https://eslint.nuxt.com/guide/migration) enabled after a fresh package installation:
- `rm -rf node_modules`
- `yarn install`
- `nuxt prepare`
- `nuxt dev`
The dev server is started, and now the eslint module writes the `./.nuxt/eslint.config.mjs` once and then again in the `builder:generateApp` hook, but in that hook it does not wait for the config to be written, so the checker is already run before that file has any contents (race condition):
> ERROR Pre-transform error: The requested module './.nuxt/eslint.config.mjs' does not provide an export named 'withNuxt' Plugin: vite:eslint2 File: [...]
On the next `nuxt dev` run the error does not occur anymore.
My options in nuxt config:
```
eslint: {
checker: { lintInWorker: false, lintOnStart: false },
config: { standalone: false },
},
```
And I have a flat config `eslint.config.mjs` in project root with the import mentioned [in the docs](https://eslint.nuxt.com/packages/module#manual-setup):
```
import withNuxt from './.nuxt/eslint.config.mjs'
```
I will provide a PR with a minimal change that waits for the config to be written in the hook.
### Additional context
_No response_
### Logs
```shell-script
```
0 条评论