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

adapters shouldn't pass arbitrary options to esbuild #4639

Merged
merged 5 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/healthy-cows-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sveltejs/adapter-cloudflare': patch
'@sveltejs/adapter-cloudflare-workers': patch
---

[breaking] Don't pass arbitrary options to esbuild
12 changes: 9 additions & 3 deletions packages/adapter-cloudflare-workers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ import { fileURLToPath } from 'url';
*/

/** @type {import('.').default} */
export default function (options = {}) {
export default function () {
// TODO remove for 1.0
if (arguments.length > 0) {
throw new Error(
'esbuild options can no longer be passed to adapter-cloudflare-workers — see https://github.com/sveltejs/kit/pull/4639'
);
}

return {
name: '@sveltejs/adapter-cloudflare-workers',

Expand Down Expand Up @@ -58,11 +65,10 @@ export default function (options = {}) {
platform: 'browser',
sourcemap: 'linked',
target: 'es2020',
...options,
entryPoints: [`${tmp}/entry.js`],
outfile: main,
bundle: true,
external: ['__STATIC_CONTENT_MANIFEST', ...(options?.external || [])],
external: ['__STATIC_CONTENT_MANIFEST'],
format: 'esm'
});

Expand Down
10 changes: 8 additions & 2 deletions packages/adapter-cloudflare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { fileURLToPath } from 'url';
import * as esbuild from 'esbuild';

/** @type {import('.').default} */
export default function (options = {}) {
export default function () {
// TODO remove for 1.0
if (arguments.length > 0) {
throw new Error(
'esbuild options can no longer be passed to adapter-cloudflare — see https://github.com/sveltejs/kit/pull/4639'
);
}

return {
name: '@sveltejs/adapter-cloudflare',
async adapt(builder) {
Expand Down Expand Up @@ -40,7 +47,6 @@ export default function (options = {}) {
platform: 'browser',
sourcemap: 'linked',
target: 'es2020',
...options,
entryPoints: [`${tmp}/_worker.js`],
outfile: `${dest}/_worker.js`,
allowOverwrite: true,
Expand Down