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

Updated esbuild to version 0.14.47 in wrangler package #1360

Merged
merged 2 commits into from
Jun 29, 2022
Merged

Updated esbuild to version 0.14.47 in wrangler package #1360

merged 2 commits into from
Jun 29, 2022

Conversation

SirCremefresh
Copy link
Contributor

Hi

I wanted to use the relatively new typescript feature "extends constraints on infer type variables".
This is supported since esbuild version v0.14.46.

Current workaround to use locally
package.json:

  "devDependencies": {
    "esbuild": "0.14.47",
    "wrangler": "2.0.15"
  },
  "overrides": {
    "wrangler": {
      "esbuild": "$esbuild"
    }
  },

@changeset-bot
Copy link

changeset-bot bot commented Jun 27, 2022

🦋 Changeset detected

Latest commit: ae188e5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

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

@threepointone
Copy link
Contributor

hmm, odd error, I can reproduce this locally. I'll have a look at this soon.

@SirCremefresh
Copy link
Contributor Author

I couldn't find anything online about this error. And I am out of ideas.
Do you have an idea where to look?

@petebacondarwin
Copy link
Contributor

petebacondarwin commented Jun 29, 2022

In the newly built version of wrangler (i.e. in wrangler-dist/cli.js) the error is on this line, which comes from the nbind library:

_a = _typeModule(_typeModule), _nbind.Type = _a.Type, _nbind.makeType = _a.makeType, _nbind.getComplexType = _a.getComplexType, _nbind.structureList = _a.structureList;

Note that _a has not been defined (or indeed is ever even mentioned) elsewhere in the file.

But this is the case for Wrangler @ 2.0.15.

I think looking at the diff between the two files. The error is caused by the new version of esbuild adding in various "use strict"; statements, which probably cause node.js to fail when it comes across the undeclared _a variable.

I believe this is caused by this change evanw/esbuild@9860ee3, which arrived in 0.14.44. There are some comments about it here: evanw/esbuild#2264 (comment).

@petebacondarwin
Copy link
Contributor

Setting alwaysStrict to false in the wrangler package tsconfig.json resolves this problem.
Pushed a commit and rebased on main.

@github-actions
Copy link
Contributor

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2582089452/npm-package-wrangler-1360

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/1360/npm-package-wrangler-1360

Or you can use npx with this latest build directly:

npx https://prerelease-registry.developers.workers.dev/runs/2582089452/npm-package-wrangler-1360 dev path/to/script.js

@threepointone
Copy link
Contributor

Thanks for the fix @petebacondarwin! Looks good to me, let's land this.

@threepointone threepointone merged commit cd66b67 into cloudflare:main Jun 29, 2022
@github-actions github-actions bot mentioned this pull request Jun 29, 2022
@SirCremefresh SirCremefresh deleted the feature/update_eslint branch June 29, 2022 10:50
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.

3 participants