nitro
nitro copied to clipboard
[vite] Adding a package import causes Nitro vite plugin to fail
Environment
Node: 22.18.0 nitro-nightly: 3.0.0-20250717-115429.740761af
Reproduction
In https://github.com/nitrojs/vite-examples/tree/main/examples/basic-service add an imports field
Example
{
"name": "nitro-vite-basic-service",
"version": "0.0.0",
"scripts": {
"build": "vite build",
"dev": "vite dev"
},
"imports": {
"#vite-config": "./vite.config.ts"
},
"devDependencies": {
"nitro": "npm:nitro-nightly",
"vite": "^7"
}
}
Describe the bug
When adding a package imports Nitro's virtual modules fail to be resolved
Missing "#nitro-internal-virtual/server-assets" specifier in "nitro-vite-basic-service" package
Can you please try latest nightly build npm:[email protected] (relavant fix was: f5f24698a0c2c4886524c03774ccb3edbf9f0667)
@pi0, I tried this out and I am still seeing the same error.
{
"name": "nitro-vite-basic-service",
"version": "0.0.0",
"scripts": {
"build": "vite build",
"dev": "vite dev"
},
"imports": {
"#vite-config": "./vite.config.ts"
},
"devDependencies": {
"nitro": "npm:[email protected]",
"vite": "^7"
}
}
$ git clean -dxf
$ npm install
$ npm run dev
$ curl http://localhost:5173/ | grep "Missing"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
<span>Missing "#nitro-internal-virtual/server-assets" specifier in "nitro-vite-basic-service" package</span>