unjs/jiti

Jiti 1.19.0 is broken with `Cannot create property on string`

daniluk4000 opened this issue · 9 comments

Environment

Nuxt 2 latest, Node 18

Reproduction

Seems to be present in Nuxt 2 minimal builds

Describe the bug

Nuxt 2 fails to start after upgrade to Jiti 1.19.0

Additional context

No response

Logs

`warp-nuxt       |  FATAL  Cannot create property '/app/nuxt.config.ts' on string '/tmp/node-jiti'
warp-nuxt       |
warp-nuxt       |   at evalModule (node_modules/jiti/dist/jiti.js:1:254815)
warp-nuxt       |   at jiti (node_modules/jiti/dist/jiti.js:1:253034)
warp-nuxt       |   at Object.loadNuxtConfig (node_modules/@nuxt/config/dist/config.js:857:15)
warp-nuxt       |   at loadNuxtConfig (node_modules/@nuxt/cli/dist/cli-index.js:295:32)
warp-nuxt       |   at NuxtCommand.getNuxtConfig (node_modules/@nuxt/cli/dist/cli-index.js:397:26)
warp-nuxt       |   at Object._listenDev (node_modules/@nuxt/cli/dist/cli-dev.js:63:30)
warp-nuxt       |   at Object.startDev (node_modules/@nuxt/cli/dist/cli-dev.js:49:25)
warp-nuxt       |   at Object.run (node_modules/@nuxt/cli/dist/cli-dev.js:44:16)
warp-nuxt       |   at NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:356:22)
warp-nuxt       |   at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
warp-nuxt       |
warp-nuxt       |
warp-nuxt       |    ╭───────────────────────────────────────────────────────────────────────╮
warp-nuxt       |    │                                                                       │
warp-nuxt       |    │   ✖ Nuxt Fatal Error                                                  │
warp-nuxt       |    │                                                                       │
warp-nuxt       |    │   TypeError: Cannot create property '/app/nuxt.config.ts' on string   │
warp-nuxt       |'/tmp/node-jiti'
warp-nuxt       |    │                                                                       │
warp-nuxt       |    ╰───────────────────────────────────────────────────────────────────────╯
warp-nuxt       |

Also CI/CD:
image

Having the same issue deploying a Shopify Hydrogen store with Oxygen

Same for Nuxt 3 here

package.json downgrade workaround

{
  "dependencies": {...},
  "resolutions": {
    "jiti": "1.18.2"
  }
}

Same error on Laravel Vite Deploy

For newer npm versions try 'overrides' instead of 'resolutions' to downgrade jiti

{ "dependencies": {...}, "overrides": { "jiti": "1.18.2" } }

Same for Nuxt 3 here

nuxt/nuxt#21931

Same here, using Svelte & Tailwind

pi0 commented

Hotfix added in jiti@1.19.1. Please make sure to upgrade lockfile to receive the fix 🙏🏼

ThaoD5 commented

Works great, thanks @pi0 !