-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
ES target ignored in certain cases [cloudflare-workers] #2679
Comments
This does not look like a problem with the v8 runtime but rather a problem with the bundling that wrangler/cf worker deploy does for you ahead of deployment when your project is set to |
Workers is always latest V8 so |
Thanks for all the help guys. Like I said, I wasn't sure what part of the pipeline was causing the issue as I never really dug into how the |
@lukeed Is there any "build" step required for wrangler? I mean there is already a single |
I've made the following changes to my wrangler.toml: type = "javascript"
[build]
command = ""
[build.upload]
format = "service-worker" The empty build command seems to work fine |
You don't need the custom build as far as I'm aware. You can just remove that empty |
It definitely needs to be there. If I remove it, I get:
|
Seems like a good change to make to the readme: https://github.com/sveltejs/kit/blob/master/packages/adapter-cloudflare-workers/README.md Want to send a PR? |
You need the type = "javascript"
[build]
command = "npm run build"
# ^^ runs the `svelte-kit build` command
[build.upload]
format = "service-worker" |
@lukeed this is not the case. If I change the command to @benmccann I'll make a PR to modify the docs :) |
Describe the bug
When updating recently to a newer version of SvelteKit and Cloudflare workers adapter I started getting an error when trying to deploy my code with
wrangler publish
I use typescript, and I have
target: es2019
specified in mytsconfig.json
, so it should be compiling down the??
.The interesting thing is this only happens under certain conditions. When I use the
??
operator in a.svelte
file, it gets compiled to es2019 without any issues. But if the code is inhooks.ts
, it doesn't get compiled down. This used to work just fine, so the issue must be in something changed in the last 2-3 weeks at most.My current work-around to fix the issue, is to add to
svelte.config.js
:kit.vite.build.target = 'es2019'
. After I add this, everything builds just fine.Reproduction
??
tohooks.ts
npm run build
workers-site/index.js
output file, you can see the??
being left in the code.Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
I'm unsure if this is a bug in Svelte, SvelteKit, Cloudflare worker adapter, or something completely different. All I know is I never had this issue until just recently, and my code has been using esnext features all along, and I only just started having issues after my most recent upgrade.
The text was updated successfully, but these errors were encountered: