Skip to content

fix: do not inject imports within node_modules#873

Merged
danielroe merged 2 commits intonuxt:mainfrom
wattanx:do-not-injection-import
Aug 3, 2023
Merged

fix: do not inject imports within node_modules#873
danielroe merged 2 commits intonuxt:mainfrom
wattanx:do-not-injection-import

Conversation

@wattanx
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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