Skip to content

fix: prefer disabling imports with imports.autoImport#853

Merged
danielroe merged 9 commits into
nuxt:mainfrom
wattanx:fix-imports-false
Jul 17, 2023
Merged

fix: prefer disabling imports with imports.autoImport#853
danielroe merged 9 commits into
nuxt:mainfrom
wattanx:fix-imports-false

Conversation

@wattanx
Copy link
Copy Markdown
Collaborator

@wattanx wattanx commented Jul 5, 2023

🔗 Linked issue

❓ 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)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

The #imports alias is set inside the import module.
So even if imports: false, I think you need to run import module.

In Nuxt 3, I believe the import module is executed even with autoImport: false.
https://github.com/nuxt/nuxt/blob/master/packages/nuxt/src/core/nuxt.ts#L406-L412

(I am wondering if I should be able to set it with the imports.autoImport option like in Nuxt 3.)

📝 Checklist

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

@wattanx wattanx requested a review from danielroe July 5, 2023 14:31
Comment thread packages/bridge/src/imports/module.ts Outdated
Comment thread packages/bridge/src/imports/module.ts
Copy link
Copy Markdown
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably still respect imports: false but warn when this is enabled, and suggest instead that they set imports.autoImports: false.

@wattanx
Copy link
Copy Markdown
Collaborator Author

wattanx commented Jul 15, 2023

@danielroe
Thanks for the review!
I agree with your opinion!
I added a warning in the following commit.
1dfe562

@wattanx wattanx requested a review from danielroe July 15, 2023 13:27
Comment thread packages/bridge/src/module.ts Outdated
Comment thread packages/bridge/src/module.ts
@danielroe danielroe changed the title fix: Fixed to be able to import from #imports fix: prefer disabling imports with imports.autoImport Jul 17, 2023
Comment thread packages/bridge/types.d.ts Outdated
@danielroe danielroe merged commit 54aa174 into nuxt:main Jul 17, 2023
@danielroe danielroe mentioned this pull request Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants