From 6f9f758326f4e77f8dcca2164f3cb76da67c96cc Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Sat, 6 Jul 2024 01:30:44 +0800 Subject: [PATCH 1/7] copy font files and do not add hash to filename --- packages/adapter-cloudflare-workers/index.js | 5 ++++- packages/adapter-cloudflare/index.js | 5 ++++- packages/adapter-netlify/index.js | 7 ++++++- packages/adapter-vercel/index.js | 7 +++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index df592eea4ffe..43f753083bc8 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -97,8 +97,11 @@ export default function ({ config = 'wrangler.toml', platformProxy = {} } = {}) alias: Object.fromEntries(compatible_node_modules.map((id) => [id, `node:${id}`])), format: 'esm', loader: { - '.wasm': 'copy' + '.wasm': 'copy', + '.woff': 'copy', + '.ttf': 'copy' }, + assetNames: '[name]', logLevel: 'silent' }); diff --git a/packages/adapter-cloudflare/index.js b/packages/adapter-cloudflare/index.js index 7ec6539862bf..a7823e164abd 100644 --- a/packages/adapter-cloudflare/index.js +++ b/packages/adapter-cloudflare/index.js @@ -90,8 +90,11 @@ export default function (options = {}) { format: 'esm', bundle: true, loader: { - '.wasm': 'copy' + '.wasm': 'copy', + '.woff': 'copy', + '.ttf': 'copy' }, + assetNames: '[name]', external, alias: Object.fromEntries(compatible_node_modules.map((id) => [id, `node:${id}`])), logLevel: 'silent' diff --git a/packages/adapter-netlify/index.js b/packages/adapter-netlify/index.js index 8f8a1c5eecd4..52b6912b149d 100644 --- a/packages/adapter-netlify/index.js +++ b/packages/adapter-netlify/index.js @@ -167,7 +167,12 @@ async function generate_edge_functions({ builder }) { platform: 'browser', sourcemap: 'linked', target: 'es2020', - + loader: { + '.wasm': 'copy', + '.woff': 'copy', + '.ttf': 'copy' + }, + assetNames: '[name]', // Node built-ins are allowed, but must be prefixed with `node:` // https://docs.netlify.com/edge-functions/api/#runtime-environment external: builtinModules.map((id) => `node:${id}`), diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index 11d7223dfa0f..d6cf46b55829 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -134,8 +134,11 @@ const plugin = function (defaults = {}) { sourcemap: 'linked', banner: { js: 'globalThis.global = globalThis;' }, loader: { - '.wasm': 'copy' - } + '.wasm': 'copy', + '.woff': 'copy', + '.ttf': 'copy' + }, + assetNames: '[name]' }); if (result.warnings.length > 0) { From d08706b85a075b5c35221cfa5604ea9f0534a3e9 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Sat, 6 Jul 2024 01:38:56 +0800 Subject: [PATCH 2/7] leave asset names alone --- packages/adapter-cloudflare-workers/index.js | 1 - packages/adapter-cloudflare/index.js | 1 - packages/adapter-netlify/index.js | 1 - packages/adapter-vercel/index.js | 3 +-- 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index 43f753083bc8..c54356e810f9 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -101,7 +101,6 @@ export default function ({ config = 'wrangler.toml', platformProxy = {} } = {}) '.woff': 'copy', '.ttf': 'copy' }, - assetNames: '[name]', logLevel: 'silent' }); diff --git a/packages/adapter-cloudflare/index.js b/packages/adapter-cloudflare/index.js index a7823e164abd..671db43dfd37 100644 --- a/packages/adapter-cloudflare/index.js +++ b/packages/adapter-cloudflare/index.js @@ -94,7 +94,6 @@ export default function (options = {}) { '.woff': 'copy', '.ttf': 'copy' }, - assetNames: '[name]', external, alias: Object.fromEntries(compatible_node_modules.map((id) => [id, `node:${id}`])), logLevel: 'silent' diff --git a/packages/adapter-netlify/index.js b/packages/adapter-netlify/index.js index 52b6912b149d..eb0c10dbf939 100644 --- a/packages/adapter-netlify/index.js +++ b/packages/adapter-netlify/index.js @@ -172,7 +172,6 @@ async function generate_edge_functions({ builder }) { '.woff': 'copy', '.ttf': 'copy' }, - assetNames: '[name]', // Node built-ins are allowed, but must be prefixed with `node:` // https://docs.netlify.com/edge-functions/api/#runtime-environment external: builtinModules.map((id) => `node:${id}`), diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index d6cf46b55829..a4d4b5a72bce 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -137,8 +137,7 @@ const plugin = function (defaults = {}) { '.wasm': 'copy', '.woff': 'copy', '.ttf': 'copy' - }, - assetNames: '[name]' + } }); if (result.warnings.length > 0) { From 2a6129ec7bd0a19ec91e76a03e1c3585d6df36d2 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Sat, 6 Jul 2024 01:40:38 +0800 Subject: [PATCH 3/7] changeset --- .changeset/silver-bears-melt.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .changeset/silver-bears-melt.md diff --git a/.changeset/silver-bears-melt.md b/.changeset/silver-bears-melt.md new file mode 100644 index 000000000000..a04954195000 --- /dev/null +++ b/.changeset/silver-bears-melt.md @@ -0,0 +1,8 @@ +--- +'@sveltejs/adapter-cloudflare-workers': patch +'@sveltejs/adapter-cloudflare': patch +'@sveltejs/adapter-netlify': patch +'@sveltejs/adapter-vercel': patch +--- + +fix: copy `.woff` and `.ttf` font files when bundling From 09f1a532be887a4ebd00216e103f5cc8dcb12a2b Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Sat, 6 Jul 2024 01:54:17 +0800 Subject: [PATCH 4/7] add .woff2 --- packages/adapter-cloudflare-workers/index.js | 1 + packages/adapter-cloudflare/index.js | 1 + packages/adapter-netlify/index.js | 1 + packages/adapter-vercel/index.js | 1 + 4 files changed, 4 insertions(+) diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index c54356e810f9..196c74f34deb 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -99,6 +99,7 @@ export default function ({ config = 'wrangler.toml', platformProxy = {} } = {}) loader: { '.wasm': 'copy', '.woff': 'copy', + '.woff2': 'copy', '.ttf': 'copy' }, logLevel: 'silent' diff --git a/packages/adapter-cloudflare/index.js b/packages/adapter-cloudflare/index.js index 671db43dfd37..a6bc26d0cca7 100644 --- a/packages/adapter-cloudflare/index.js +++ b/packages/adapter-cloudflare/index.js @@ -92,6 +92,7 @@ export default function (options = {}) { loader: { '.wasm': 'copy', '.woff': 'copy', + '.woff2': 'copy', '.ttf': 'copy' }, external, diff --git a/packages/adapter-netlify/index.js b/packages/adapter-netlify/index.js index eb0c10dbf939..9a04130cccba 100644 --- a/packages/adapter-netlify/index.js +++ b/packages/adapter-netlify/index.js @@ -170,6 +170,7 @@ async function generate_edge_functions({ builder }) { loader: { '.wasm': 'copy', '.woff': 'copy', + '.woff2': 'copy', '.ttf': 'copy' }, // Node built-ins are allowed, but must be prefixed with `node:` diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index a4d4b5a72bce..d16d032e1f75 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -136,6 +136,7 @@ const plugin = function (defaults = {}) { loader: { '.wasm': 'copy', '.woff': 'copy', + '.woff2': 'copy', '.ttf': 'copy' } }); From 482c60e33f3dcbdacb96c2a2891acdc2f5c52f89 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Sat, 6 Jul 2024 01:57:15 +0800 Subject: [PATCH 5/7] update changeset --- .changeset/silver-bears-melt.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/silver-bears-melt.md b/.changeset/silver-bears-melt.md index a04954195000..94c36b8fb2b9 100644 --- a/.changeset/silver-bears-melt.md +++ b/.changeset/silver-bears-melt.md @@ -5,4 +5,4 @@ '@sveltejs/adapter-vercel': patch --- -fix: copy `.woff` and `.ttf` font files when bundling +fix: copy `.woff`, `woff2`, and `.ttf` font files when bundling From ea14400be5a0bca444d8cd51899e49d6636d459c Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Sat, 6 Jul 2024 21:49:06 +0800 Subject: [PATCH 6/7] add eof and otf --- .changeset/silver-bears-melt.md | 2 +- packages/adapter-cloudflare-workers/index.js | 4 +++- packages/adapter-cloudflare/index.js | 4 +++- packages/adapter-netlify/index.js | 4 +++- packages/adapter-vercel/index.js | 4 +++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.changeset/silver-bears-melt.md b/.changeset/silver-bears-melt.md index 94c36b8fb2b9..3193601e1336 100644 --- a/.changeset/silver-bears-melt.md +++ b/.changeset/silver-bears-melt.md @@ -5,4 +5,4 @@ '@sveltejs/adapter-vercel': patch --- -fix: copy `.woff`, `woff2`, and `.ttf` font files when bundling +fix: copy `.eof`, `.otf`, `.ttf`, `.woff`, and `woff2` font files when bundling diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index 196c74f34deb..00c9575a55fd 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -100,7 +100,9 @@ export default function ({ config = 'wrangler.toml', platformProxy = {} } = {}) '.wasm': 'copy', '.woff': 'copy', '.woff2': 'copy', - '.ttf': 'copy' + '.ttf': 'copy', + '.eof': 'copy', + '.otf': 'copy' }, logLevel: 'silent' }); diff --git a/packages/adapter-cloudflare/index.js b/packages/adapter-cloudflare/index.js index a6bc26d0cca7..f7d06dc93676 100644 --- a/packages/adapter-cloudflare/index.js +++ b/packages/adapter-cloudflare/index.js @@ -93,7 +93,9 @@ export default function (options = {}) { '.wasm': 'copy', '.woff': 'copy', '.woff2': 'copy', - '.ttf': 'copy' + '.ttf': 'copy', + '.eof': 'copy', + '.otf': 'copy' }, external, alias: Object.fromEntries(compatible_node_modules.map((id) => [id, `node:${id}`])), diff --git a/packages/adapter-netlify/index.js b/packages/adapter-netlify/index.js index 9a04130cccba..4d65f459d230 100644 --- a/packages/adapter-netlify/index.js +++ b/packages/adapter-netlify/index.js @@ -171,7 +171,9 @@ async function generate_edge_functions({ builder }) { '.wasm': 'copy', '.woff': 'copy', '.woff2': 'copy', - '.ttf': 'copy' + '.ttf': 'copy', + '.eof': 'copy', + '.otf': 'copy' }, // Node built-ins are allowed, but must be prefixed with `node:` // https://docs.netlify.com/edge-functions/api/#runtime-environment diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index d16d032e1f75..0c044018417d 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -137,7 +137,9 @@ const plugin = function (defaults = {}) { '.wasm': 'copy', '.woff': 'copy', '.woff2': 'copy', - '.ttf': 'copy' + '.ttf': 'copy', + '.eof': 'copy', + '.otf': 'copy' } }); From 53ab3fa10d05ac902f1602d222c80b8862035773 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Sat, 6 Jul 2024 21:50:08 +0800 Subject: [PATCH 7/7] oops i mean .eot --- .changeset/silver-bears-melt.md | 2 +- packages/adapter-cloudflare-workers/index.js | 2 +- packages/adapter-cloudflare/index.js | 2 +- packages/adapter-netlify/index.js | 2 +- packages/adapter-vercel/index.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.changeset/silver-bears-melt.md b/.changeset/silver-bears-melt.md index 3193601e1336..924cc3a40fa7 100644 --- a/.changeset/silver-bears-melt.md +++ b/.changeset/silver-bears-melt.md @@ -5,4 +5,4 @@ '@sveltejs/adapter-vercel': patch --- -fix: copy `.eof`, `.otf`, `.ttf`, `.woff`, and `woff2` font files when bundling +fix: copy `.eot`, `.otf`, `.ttf`, `.woff`, and `woff2` font files when bundling diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index 00c9575a55fd..cb886a0edf66 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -101,7 +101,7 @@ export default function ({ config = 'wrangler.toml', platformProxy = {} } = {}) '.woff': 'copy', '.woff2': 'copy', '.ttf': 'copy', - '.eof': 'copy', + '.eot': 'copy', '.otf': 'copy' }, logLevel: 'silent' diff --git a/packages/adapter-cloudflare/index.js b/packages/adapter-cloudflare/index.js index f7d06dc93676..413f1807930b 100644 --- a/packages/adapter-cloudflare/index.js +++ b/packages/adapter-cloudflare/index.js @@ -94,7 +94,7 @@ export default function (options = {}) { '.woff': 'copy', '.woff2': 'copy', '.ttf': 'copy', - '.eof': 'copy', + '.eot': 'copy', '.otf': 'copy' }, external, diff --git a/packages/adapter-netlify/index.js b/packages/adapter-netlify/index.js index 4d65f459d230..f843ed46b809 100644 --- a/packages/adapter-netlify/index.js +++ b/packages/adapter-netlify/index.js @@ -172,7 +172,7 @@ async function generate_edge_functions({ builder }) { '.woff': 'copy', '.woff2': 'copy', '.ttf': 'copy', - '.eof': 'copy', + '.eot': 'copy', '.otf': 'copy' }, // Node built-ins are allowed, but must be prefixed with `node:` diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index 0c044018417d..46a3e00bdf68 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -138,7 +138,7 @@ const plugin = function (defaults = {}) { '.woff': 'copy', '.woff2': 'copy', '.ttf': 'copy', - '.eof': 'copy', + '.eot': 'copy', '.otf': 'copy' } });