Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(vite): improve external checks for dev-bundler #1538

Merged
merged 8 commits into from
Oct 29, 2021

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Oct 28, 2021

πŸ”— Linked issue

Lots! For example nuxt/nuxt#12233
closes nuxt/nuxt#12632

❓ 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

With this PR we use an upgraded externality to try to detect (using new utility: unjs/mlly#16) whether an external is in fact valid to import within a node context.

πŸ“ Checklist

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

@danielroe danielroe added bug Something isn't working enhancement New feature or request dx vite labels Oct 28, 2021
@danielroe danielroe requested a review from pi0 October 28, 2021 09:49
@danielroe danielroe self-assigned this Oct 28, 2021
@netlify
Copy link

netlify bot commented Oct 28, 2021

βœ”οΈ Deploy Preview for nuxt3-docs ready!

πŸ”¨ Explore the source changes: b5f7228

πŸ” Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/617bb2aa8f73860007c039dd

😎 Browse the preview: https://deploy-preview-1538--nuxt3-docs.netlify.app

@danielroe danielroe marked this pull request as draft October 28, 2021 15:14
packages/vite/src/dev-bundler.ts Outdated Show resolved Hide resolved
packages/vite/src/dev-bundler.ts Outdated Show resolved Hide resolved
@danielroe danielroe marked this pull request as ready for review October 28, 2021 17:30
@pi0 pi0 changed the title feat(vite): automatically inline invalid node imports fix(vite): improve external checks for dev-bundler Oct 29, 2021
@@ -41,7 +41,6 @@ export async function buildServer (ctx: ViteBuildContext) {
external: [],
noExternal: [
...ctx.nuxt.options.build.transpile,
/\.(es|esm|esm-browser|esm-bundler).js$/,
Copy link
Member

Choose a reason for hiding this comment

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

Since we are not using externality for prod build, I think would be a safe pattern to keep

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. Shall I follow up with a PR adding externality support for nitro?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested next steps:

  • Support externality for vite's prod build
  • Support externality for webpack external checks
  • Support externality for nitro

Copy link
Member Author

Choose a reason for hiding this comment

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

@pi0 pi0 merged commit bdbfa36 into main Oct 29, 2021
@pi0 pi0 deleted the feat/automatic-inlining-detection branch October 29, 2021 08:43
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working dx enhancement New feature or request vite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exports is not defined in ES module scope
2 participants