-
Notifications
You must be signed in to change notification settings - Fork 551
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
Pages Functions Wasm cleanup #2806
Conversation
🦋 Changeset detectedLatest commit: b410c49 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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/4354494434/npm-package-wrangler-2806 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/2806/npm-package-wrangler-2806 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4354494434/npm-package-wrangler-2806 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4354494434/npm-package-cloudflare-pages-shared-2806 Note that these links will no longer work once the GitHub Actions artifact expires. |
133238f
to
970c80b
Compare
Codecov Report
@@ Coverage Diff @@
## main #2806 +/- ##
==========================================
- Coverage 74.05% 73.96% -0.10%
==========================================
Files 166 166
Lines 10218 10250 +32
Branches 2734 2744 +10
==========================================
+ Hits 7567 7581 +14
- Misses 2651 2669 +18
|
f8b4392
to
b377669
Compare
packages/wrangler/src/pages/build.ts
Outdated
const functionsOutfile = experimentalWorkerBundle | ||
? join(tmpdir(), `./functionsWorker-${Math.random()}.js`) | ||
: outfile; | ||
const functionsOutfile = plugin |
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.
We have to keep this conditional in for building Pages Plugins. I'll follow up with another PR soon which produces a outdir
rather than a single file in the case of a Plugin.
packages/wrangler/src/pages/build.ts
Outdated
const workerBundleContents = await createUploadWorkerBundleContents( | ||
bundle as BundleResult | ||
); | ||
|
||
mkdirSync(dirname(outfile), { recursive: true }); |
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.
If I specify wrangler pages functions build --outfile=some/dir/that/doesnt/exist.js
it would fail which is unlike the previous pre-bundling behavior.
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.
Nice! Just one suggestion.
f4911d3
to
ba7c5d4
Compare
2c7bcc6
to
50abac0
Compare
50abac0
to
d626f62
Compare
Related: #2836 |
3a27392
to
6f79b09
Compare
8e637ff
to
9295957
Compare
reviewed one more time and LGTM |
… `pages publish` This is now enabled by default with intentionally no way to disable.
cc6b8e7
to
b410c49
Compare
What this PR solves / how to test:
This does two big things (and one little one):
--experimental-worker-bundle
option from Pages Functions. We now just always do this. It was temporarily added for us to test the new_worker.bundle
upload format.--bundle
by default inpages dev
andpages publish
. This means that you're able to use Wasm etc. in_worker.js
projects..wasm
and.bin
files as external when building a Plugin. We already do this withassets:
, so there's prior art here, but this is ultimately only a stop-gap until we change the output format to an--outdir
rather than an--outfile
for Plugins. We'll follow up soon-ish with that.Associated docs issues/PR:
Author has included the following, where applicable:
Reviewer has performed the following, where applicable:
Fixes # [insert issue number].