feat: add support for custom unenv resolve path#7522
Conversation
🦋 Changeset detectedLatest commit: 37aeba8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-wrangler-7522You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7522/npm-package-wrangler-7522Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-wrangler-7522 dev path/to/script.jsAdditional artifacts:wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-workers-bindings-extension-7522 -O ./cloudflare-workers-bindings-extension.0.0.0-v638d96862.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v638d96862.vsixnpx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-create-cloudflare-7522 --no-auto-updatenpm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-kv-asset-handler-7522npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-miniflare-7522npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-pages-shared-7522npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-vitest-pool-workers-7522npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-workers-editor-shared-7522npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-workers-shared-7522npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-workflows-shared-7522Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
5a39e9e to
20bb308
Compare
|
LGTM! Small point: It is technically UNENV_RESOLVE_PATHS not specific to preset paths only 😄 |
8a85559 to
3023c61
Compare
3023c61 to
2e013e1
Compare
There was a problem hiding this comment.
Can we clarify this statement. Which package.json are we referring to here? Is it the user's one or the one inside the wrangler package?
There was a problem hiding this comment.
I updated the description, PTAL.
There was a problem hiding this comment.
I find this naming a bit confusing. I think that we are only using this path to resolve from imports like unenv/foo/bar to some absolute path, right? It doesn't affect other imports? Are we really just providing custom paths to the unenv package? Is there some other use for thes paths? If not, then I would expect this to be more like WRANGLER_UNENV_PACKAGE_PATH.
There was a problem hiding this comment.
The paths are used when unenv resolve the absolute paths.
The module specifiers could be unenv/... or @cloudflare/unenv-preset/...
I like "RESOLVE_PATHS" because it matches require.resolve(id, { paths }) but happy to change if you have strong feeling on this one.
Introduce `WRANGLER_UNENV_RESOLVE_PATHS` to specify a custom root paths for unenv.
Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com>
47a73e3 to
37aeba8
Compare
We are moving the unenv preset to this repo.
We will need to be able to test the version that is package with wrangler as well as the dev version. We can do that by passing the path to the dev version in the added env var.
/cc @pi0