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

fix(nuxi, kit): import individual semver function #1598

Merged
merged 5 commits into from Nov 2, 2021
Merged

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Oct 30, 2021

πŸ”— Linked issue

closes nuxt/nuxt#12839
closes nuxt/nuxt#12673

❓ 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

This is an issue with rollup bundling semver into the nuxi bundle. The bundled file is (abbreviated):

class Range$a {
  constructor (range, options) {
    if (range instanceof Comparator$3) {
      // ...
    }
  }
}

const Comparator$3 = comparator

class Comparator$2 {
  constructor (comp, options) {
    if (comp instanceof Comparator$2) {
      // ...
    }
  }
}

var comparator = Comparator$2;

In other words, we have a bit of mis-ordering of the file. So when semver.satisfies hits an error, because Comparator$3 isn't an object, it swallows it and returns false.

See npm/node-semver#381

This PR implements the workaround described in this comment - which also, as a plus, decreases our bundle size.

πŸ“ Checklist

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

@danielroe danielroe added bug Something isn't working cli labels Oct 30, 2021
@danielroe danielroe requested a review from pi0 October 30, 2021 06:21
@danielroe danielroe self-assigned this Oct 30, 2021
@netlify
Copy link

netlify bot commented Oct 30, 2021

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

πŸ”¨ Explore the source changes: 0408cf3

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

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

@pi0 pi0 merged commit 47e0721 into main Nov 2, 2021
@pi0 pi0 deleted the fix/semver-rollup branch November 2, 2021 09: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 cli
Projects
None yet
Development

Successfully merging this pull request may close these issues.

node version detection is warning on compatible version Their is something wrong with this error.
2 participants