Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kit): resolve relative module paths when installing #20896

Merged
merged 1 commit into from May 20, 2023

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

partly resolves #20883

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Regression introduced in #20757. We need to normalise module relative paths.

There's still an issue where loading an implicit index (e.g. ~/modules/test for ~/modules/test/index) fails owing to jiti trying to read the directory, but I think that's consistent with the ESM ecosystem. (cc: @pi0)

Details

 ERROR  Error while requiring module ./modules/test/: Error: EISDIR: illegal operation on a directory, read                                                             22:35:47


 ERROR  Cannot restart nuxt:  EISDIR: illegal operation on a directory, read                                                                                            22:35:47

  at Object.readSync (node:fs:757:3)
  at tryReadSync (node:fs:438:20)
  at readFileSync (node:fs:484:19)
  at jiti (node_modules/.pnpm/jiti@1.18.2/node_modules/jiti/dist/jiti.js:1:244019)
  at requireModule (packages/kit/src/internal/cjs.ts:108:26)
  at normalizeModule (packages/kit/src/module/install.ts:63:125)
  at async installModule (packages/kit/src/module/install.ts:13:41)
  at async initNuxt (packages/nuxt/src/core/nuxt.ts:339:7)
  at async load (packages/nuxi/src/commands/dev.ts:132:9)
  at async _applyPromised (node_modules/.pnpm/perfect-debounce@1.0.0/node_modules/perfect-debounce/dist/index.cjs:56:10)

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe requested a review from pi0 May 16, 2023 21:39
@danielroe danielroe self-assigned this May 16, 2023
@danielroe danielroe merged commit 26861e6 into main May 20, 2023
19 checks passed
@danielroe danielroe deleted the fix/relative-module-import branch May 20, 2023 22:10
@github-actions github-actions bot mentioned this pull request May 20, 2023
@github-actions github-actions bot mentioned this pull request May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot run npm install with custom modules with Nuxt 3.5.0
1 participant