Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Cloudflare Workers adapter target
When attempting to upload a SvelteKit app which contains modern ES features such as optional chaining or nullish coalescing, workers is unable to parse the built output. ``` Module parse failed: Unexpected token (13066:47) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | if (typeof window !== "undefined") { | const windowAny = window; > const dataLayer = windowAny.dataLayer ?? []; | windowAny.dataLayer = dataLayer; | gtag = function() { Error: webpack returned an error. You may be able to resolve this issue by running npm install ``` I could not find any official documentation of what version of ES workers support, but ES2020 is the year that nullish coalescing was introduced, and setting it to ES2019 appears to fix the issue.
- Loading branch information