github cloudflare/workers-sdk @cloudflare/vite-plugin@0.1.1

latest releases: @cloudflare/vitest-pool-workers@0.7.1, @cloudflare/vite-plugin@0.1.3, wrangler@3.109.2...
8 days ago

Patch Changes

  • #8118 ca3cbc4 Thanks @petebacondarwin! - fix Node.js compat module resolution

    In v0.0.8 we landed support for Vite 6.1 and also switched to using the new Cloudflare owned unenv preset.
    Unfortunately, the changes made in that update caused a regression in Node.js support.
    This became apparent only when the plugin was being used with certain package managers and outside of the workers-sdk monorepo.

    The unenv polyfills that get compiled into the Worker are transitive dependencies of this plugin, not direct dependencies of the user's application were the plugin is being used.
    This is on purpose to avoid the user having to install these dependencies themselves.

    Unfortunately, the changes in 0.0.8 did not correctly resolve the polyfills from @cloudflare/unenv-preset and unenv when the dependencies were not also installed directly into the user's application.

    The approach was incorrectly relying upon setting the importer in calls to Vite's resolve(id, importer) method to base the resolution in the context of the vite plugin package rather than the user's application.
    This doesn't work because the importer is only relevant when the id is relative, and not a bare module specifier in the case of the unenv polyfills.

    This change fixes how these id are resolved in the plugin by manually resolving the path at the appropriate point, while still leveraging Vite's resolution pipeline to handle aliasing, and dependency optimization.

    This change now introduces e2e tests that checks that isolated installations of the plugin works with npm, pnpm and yarn.

  • Updated dependencies [28b1dc7]:

    • wrangler@3.109.1
    • @cloudflare/unenv-preset@1.1.2

Don't miss a new workers-sdk release

NewReleases is sending notifications on new releases.