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: do not inject imports within node_modules #873

Merged
merged 2 commits into from
Aug 3, 2023

Conversation

wattanx
Copy link
Collaborator

@wattanx wattanx commented Jul 28, 2023

πŸ”— Linked issue

Fixes: #870

❓ 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

I have fixed it so that it throws an error if autoImport: false as in Nuxt 3.

πŸ“ Checklist

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

expect(await transform('let ref = () => {}; const a = ref(0)')).to.equal(undefined)
expect(await transform('let { ref } = Vue; const a = ref(0)')).to.equal(undefined)
expect(await transform('let [\ncomputed,\nref\n] = Vue; const a = ref(0); const b = ref(0)')).to.equal(undefined)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this fix #33?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can't reproduce it and don't know what caused it, so I don't know if it will be fixed...

// import { computed } from \\"foo\\"
;const a = computed(0)"
`)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worthwhile to add another assertion here that it can ignore block style comments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it is worthwhile if block style comments are not ignored.

@wattanx wattanx requested a review from danielroe July 29, 2023 08:13
@danielroe danielroe changed the title fix: autoImport: if false, do not inject import fix: do not inject imports within node_modules Aug 3, 2023
@danielroe danielroe merged commit 59db787 into nuxt:main Aug 3, 2023
9 checks passed
@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.

Disabling auto imports with imports.autoImport: false doesn't work
3 participants