-
Notifications
You must be signed in to change notification settings - Fork 762
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
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-7522 You 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-7522 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-wrangler-7522 dev path/to/script.js Additional 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.vsix npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-create-cloudflare-7522 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-kv-asset-handler-7522 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-miniflare-7522 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-pages-shared-7522 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-vitest-pool-workers-7522 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-workers-editor-shared-7522 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-workers-shared-7522 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12370972522/npm-package-cloudflare-workflows-shared-7522 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
packages/wrangler/src/deployment-bundle/esbuild-plugins/hybrid-nodejs-compat.ts
Outdated
Show resolved
Hide resolved
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
.changeset/fluffy-eggs-film.md
Outdated
|
||
feat(wrangler): allow overriding the unenv preset paths | ||
|
||
By default wrangler uses the unenv preset installed via package.json. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the description, PTAL.
.changeset/fluffy-eggs-film.md
Outdated
|
||
By default wrangler uses the unenv preset installed via package.json. | ||
|
||
Setting `WRANGLER_UNENV_RESOLVE_PATHS` allow to use a local version of the preset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
47a73e3
to
37aeba8
Compare
feat(wrangler): add support for custom unenv resolve path Introduce `WRANGLER_UNENV_RESOLVE_PATHS` to specify resolve paths for unenv. Co-authored-by: Pete Bacon Darwin <[email protected]>
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