unocss: Nuxt 3.9.0 Internal server error: Soft-invalidated module "entry.js" should not have existing transform result
UnoCSS version
0.58.2
Describe the bug
After running nuxt dev server, go to browser and refresh the page once, the error will show up.
Internal server error: Soft-invalidated module "/node_modules/nuxt/dist/app/entry.js" should not have existing transform result
Reproduction
- create a new nuxt project
- add
@unocss/nuxt
module - run
nuxt dev
- go to browser, no error on first load
- (Require this step) refresh the page once and the error shows up
https://stackblitz.com/edit/github-xtxzaj?file=package.json
Additional info
Already try to add the following config regarding to https://github.com/unocss/unocss/issues/3468#issuecomment-1871049463 but still having error
export default defineConfig({
features: {
inlineStyles: false,
},
})
System Info
"nuxt": "^3.9.0",
"vue": "^3.4.0",
"vue-router": "^4.2.5"
Validations
- Read the Contributing Guidelines.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Reactions: 37
- Comments: 31 (9 by maintainers)
Commits related to this issue
- fix: temporary fix to unocss issue with new nuxt version + innecesary critters https://github.com/unocss/unocss/issues/3472 when the issue is solve we must remove the inlineStyles: false on nuxt.conf... — committed to Aterbonus/nuxt-template by Aterbonus 6 months ago
- fix(nuxt): disable nuxt inlineStyles by default, #3472 — committed to unocss/unocss by antfu 5 months ago
Alright, hopefully https://github.com/vitejs/vite/pull/15768 should fix this
After upgrading to Nuxt 3.9.3 everything is working fine for me.
Again, I would need a minimal reproduction to investigate this - saying +1 does not improve the situation, for the record. Thanks
Any news on this?
I do indeed have the same issue but it kinda disappears after a few refreshes? Not really consistent but not a huge blocker either. 🤔
https://stackblitz.com/edit/github-dqvhqs?file=package.json This link provides the minimal reproduction. To reproduce the warning, please follow these steps:
unocss 5.8.3 nuxt 3.9.3 vue 3.3.13 vue-router latest
Internal server error: Soft-invalidated module "/node_modules/.pnpm/nuxt@3.9.3_eslint@8.56.0_rollup@4.9.5_sass@1.70.0_typescript@5.3.3_vite@5.0.12/node_modules/nuxt/dist/app/entry.js" should not have existing transform result
Just tested and this issue should be fixed since
vite v5.1.0
(nuxt v3.10.2
). Related commits: https://github.com/vitejs/vite/pull/15768, https://github.com/vitejs/vite/pull/15785Thank you @antfu, @bluwy 🍻
It’s probably introduced in https://github.com/vitejs/vite/pull/14654, not yet sure how to fix it, investigating
Already update the reproduction link with the latest UnoCSS version
0.58.4
and the error still shows up. https://stackblitz.com/edit/github-xtxzaj?file=package.jsonSteps
https://github.com/unocss/unocss/assets/44749100/e11d8894-a835-42d2-9b07-28b3135a6c3b
You can use any one reproduction from above and test it like just refresh the page in browser. I think its not working on stackblitz or any sandboxes, you need start it on local environment
Hmm I am still seeing the bug in the latest release, version
^0.58.4
. The issue arises during the initial startup but is resolved upon refreshing the page… Although its hard to replicate, after that first initial issue, I can’t seem to get it to reappear when I start/stop the dev sever again.Actually I have to wait about 30sec to a min after stopping/starting the dev sever for it to reappear. Here is a screenshot from just right now:
Hmm could this have anything to do with using
@unocss/transformer-directives
within a sass scoped context? I have some styling on my Nuxt components like this:unocss 5.8.3 @unocss/nuxt 0.58.3 nuxt 3.9.3 vue 3.4.15
+1, I have temporarily downgraded nuxt to version 3.8.2.
Maybe it is also depending on the OS of the user. In my case Linux (Ubuntu) works worse than MacOS hence it’s a bit tricky to reproduce properly on MacOS.
I downloaded code from stackblitz. link above
I’m not coding nuxt, but I tried debug error after I read on Twitter =))) I recorded an error in this link, everybody can check: https://streamable.com/hvrvnw
Step: 1: npm run dev open localhost at the first browser 2: turn off npm run dev 3: remove .nuxt and node_modules/.cache 4: open 2nd browser 5: npm run dev and open localhost at 2nd browser => The error will appear on the first browser
The error still appears despite this
Putting this in my Nuxt config worked in my scenario:
Original answer