-
Notifications
You must be signed in to change notification settings - Fork 788
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
chore: update esbuild #6884
chore: update esbuild #6884
Conversation
🦋 Changeset detectedLatest commit: 3994b48 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/12118790774/npm-package-wrangler-6884 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6884/npm-package-wrangler-6884 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12118790774/npm-package-wrangler-6884 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12118790774/npm-package-create-cloudflare-6884 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12118790774/npm-package-cloudflare-kv-asset-handler-6884 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12118790774/npm-package-miniflare-6884 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12118790774/npm-package-cloudflare-pages-shared-6884 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12118790774/npm-package-cloudflare-vitest-pool-workers-6884 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12118790774/npm-package-cloudflare-workers-editor-shared-6884 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12118790774/npm-package-cloudflare-workers-shared-6884 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12118790774/npm-package-cloudflare-workflows-shared-6884 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
354d42d
to
c7424a9
Compare
c7424a9
to
082a0e6
Compare
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 absolutely LOVE this! Being stuck with an older esbuild version has bugged me in many projects.
However, the breaking changes caveats seem like a lot of possible concern, not to mention the platforms supported dropped in newer esbuild versions that wrangler still technically supports today with its node.js 16 minimum version req.
Is this the time to just rip off the band-aid and do more frequent majors, making this part of a v4? 👀
There's a quote from one of the recent esbuild releases that I love, and I hope wrangler can follow too one day:
This release doesn't contain any deliberately-breaking changes. However, it contains a very complex new feature and while all of esbuild's tests pass, I would not be surprised if an important edge case turns out to be broken. So I'm releasing this as a breaking change release to avoid causing any trouble.
I'm not convinced this should be a major release, but we haven't taken a call on it yet. |
@Cherry Could you try this release (with |
Sadly almost all of my non-trivial projects use custom builds for things like Sentry releases, etc. but on the few personal projects I've tried this on, it all seems to be working fine. |
Hi and thanks for this! I came in here to file an issue but you were already on it. :) For what it is worth: I tried this on my shopify app project using the latest cloudflare workers for remix deploy method and it now succesfully builds! |
awesome. I'm continuing work on this. we've figured out a way to make this opt-in, but it'll take a little effort. |
082a0e6
to
b6aae7e
Compare
1a08fd5
to
167d36b
Compare
167d36b
to
5f02ed3
Compare
esbuild 0.24.2 variable naming changes
esbuild 0.24.2 variable naming changes
What this PR solves / how to test
Fixes #5222
This patch updates esbuild from 0.17.19 to 0.24.0. That's a big bump! Lots has gone into esbuild since May '23. All the details are available at https://github.com/evanw/esbuild/blob/main/CHANGELOG.md / https://github.com/evanw/esbuild/blob/main/CHANGELOG-2023.md.
We now support all modern JavasScript/TypeScript features suported by esbuild (as of September 2024). New additions include standard decorators, auto-accessors, and the
using
syntax.0.18 introduced wider support for configuration specified via
tsconfig.json
Proposedtsconfig.json
changes evanw/esbuild#3019. After observing the (lack of) any actual broken code over the last year for this release, we feel comfortable releasing this without considering it a breaking change.0.19.3 introduced support for import attributes
While we don't currently expose the esbuild configuration for developers to add their own plugins to customise how modules with import attributes are bundled, we may introduce new "types" ourselves in the future.
0.19.0 introduced support for wildcard imports. Specifics here (https://github.com/evanw/esbuild/blob/main/CHANGELOG-2023.md#0190). tl;dr -
These 2 patterns will bundle all files that match the glob pattern into a single file.
This pattern will NOT bundle any matching patterns:
You can use
find_additional_modules
to bundle any additional modules that are not referenced in the code but are required by the project.Now, this MAY be a breaking change for some. Specifically, if you were previously using the pattern (that will now include all files matching the glob pattern in the bundle), BUT
find_additional_modules
was NOT configured to include some files, those files would now be included in the bundle. For example, consider this code:Imagine if in that folder, you had these 3 files:
And your
wrangler.toml
was:Before this update:
A request to anything but
http://localhost:8787/
would error. For example, a request tohttp://localhost:8787/one.js
would error with No such module "one.js".Let's configure
wrangler.toml
to include all.js
files in thesrc
folder:Now, a request to
http://localhost:8787/one.js
would return the contents ofsrc/one.js
, but a request tohttp://localhost:8787/hidden/secret.js
would error with No such module "hidden/secret.js". To include this file, you could expand therules
array to be:Then, a request to
http://localhost:8787/hidden/secret.js
will return the contents ofsrc/hidden/secret.js
.After this update:
Now, a request to
http://localhost:8787/one.js
will return the contents ofsrc/one.js
, but a request tohttp://localhost:8787/hidden/secret.js
will ALSO return the contents ofsrc/hidden/secret.js
. THIS MAY NOT BE WHAT YOU WANT. You can "fix" this in 2 ways:Now, no extra modules are included in the bundle, and a request to
http://localhost:8787/hidden/secret.js
will throw an error. You can use thefind_additional_modules
feature to include it again.Further, there may be some files that aren't modules (js/ts/wasm/text/binary/etc) that are in the folder being included (For example, a
photo.jpg
file). This pattern will now attempt to include them in the bundle, and throw an error. It will look like this:[ERROR] No loader is configured for ".png" files: src/photo.jpg
To fix this, simply move the offending file to a different folder.
In general, we DO NOT recommend using the wildcard import pattern. If done wrong, it can leak files into your bundle that you don't want, or make your worker slightly slower to start. If you must use it (either with a wildcard import pattern or with
find_additional_modules
) you must be diligent to check that your worker is working as expected and that you are not leaking files into your bundle that you don't want. You can configure eslint to disallow dynamic imports like this:Author has addressed the following