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

perf!: client / server subpaths #448

Merged
merged 2 commits into from
Jan 8, 2025
Merged

Conversation

harlan-zw
Copy link
Collaborator

@harlan-zw harlan-zw commented Jan 7, 2025 β€’

πŸ”— 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)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

To ensure that client and server code is properly treeshaken, we now use subpath exports to differentiate the two ways of using Unhead.

import { createHead } from 'unhead/client'

// avoids bundling server plugins
createHead()

This is a breaking change if you were relying on any of the following:

  • createServerHead() (is replaced by createHead() from unhead/server
  • createHead() (imported from unhead), now imported from unhead/client

With this change we also soft deprecate @unhead/ssr and @unhead/dom as the same functionality is now exported by the associated subpath export.

⚠️ Updated import paths

🚦 Impact Level: Critical

The path where you import createHead from has been updated to be a subpath export. If you're not using Unhead through a framework (such as Nuxt), then this will be a breaking change.

πŸ“œ Migration Guide

ℹ️ Import your createHead's from unhead/legacy and you'll get the same v1 behavior.

Please follow the updated installation instructions or simply update the import to use the subpath.

Client bundle:

import { createHead } from 'unhead/client'

// avoids bundling server plugins
createHead()

Server bundle:

import { createHead } from 'unhead/server'

// avoids bundling server plugins
createHead()

Sorry, something went wrong.

@harlan-zw harlan-zw mentioned this pull request Jan 7, 2025
54 tasks
@harlan-zw harlan-zw merged commit 49634d3 into main Jan 8, 2025
2 checks passed
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.

None yet

1 participant