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

Revert "[fix] set platform to neutral when calling esbuild" #8122

Merged
merged 4 commits into from Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/smooth-pianos-kiss.md
@@ -0,0 +1,8 @@
---
'@sveltejs/adapter-cloudflare': patch
'@sveltejs/adapter-cloudflare-workers': patch
'@sveltejs/adapter-netlify': patch
'@sveltejs/adapter-vercel': patch
---

[fix] revert platform change from browser to neutral
7 changes: 3 additions & 4 deletions packages/adapter-cloudflare-workers/index.js
Expand Up @@ -62,15 +62,14 @@ export default function ({ config = 'wrangler.toml' } = {}) {
);

await esbuild.build({
platform: 'neutral',
mainFields: ['module', 'main'],
conditions: ['worker'],
platform: 'browser',
dummdidumm marked this conversation as resolved.
Show resolved Hide resolved
sourcemap: 'linked',
target: 'es2020',
entryPoints: [`${tmp}/entry.js`],
outfile: main,
bundle: true,
external: ['__STATIC_CONTENT_MANIFEST']
external: ['__STATIC_CONTENT_MANIFEST'],
format: 'esm'
});

builder.log.minor('Copying assets...');
Expand Down
5 changes: 2 additions & 3 deletions packages/adapter-cloudflare/index.js
Expand Up @@ -54,14 +54,13 @@ export default function () {
});

await esbuild.build({
platform: 'neutral',
mainFields: ['module', 'main'],
conditions: ['worker'],
platform: 'browser',
sourcemap: 'linked',
target: 'es2020',
entryPoints: [`${tmp}/_worker.js`],
outfile: `${dest}/_worker.js`,
allowOverwrite: true,
format: 'esm',
bundle: true
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-netlify/index.js
Expand Up @@ -129,11 +129,11 @@ async function generate_edge_functions({ builder }) {
);

await esbuild.build({
platform: 'neutral',
mainFields: ['module', 'main'],
entryPoints: [`${tmp}/entry.js`],
outfile: '.netlify/edge-functions/render.js',
bundle: true,
format: 'esm',
platform: 'browser',
sourcemap: 'linked',
target: 'es2020'
});
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-vercel/index.js
Expand Up @@ -122,12 +122,12 @@ const plugin = function ({ external = [], edge, split } = {}) {
);

await esbuild.build({
platform: 'neutral',
mainFields: ['module', 'main'],
entryPoints: [`${tmp}/edge.js`],
outfile: `${dirs.functions}/${name}.func/index.js`,
target: 'es2020', // TODO verify what the edge runtime supports
bundle: true,
platform: 'browser',
format: 'esm',
external,
sourcemap: 'linked',
banner: { js: 'globalThis.global = globalThis;' }
Expand Down