diff options
author | 2024-03-28 09:17:53 +0100 | |
---|---|---|
committer | 2024-03-28 09:17:53 +0100 | |
commit | 8ef3050f1461bb824f095af5157624bfb68ef63c (patch) | |
tree | fa14f03b307c4fea4218f89ce75fceea48790a81 /packages/integrations/cloudflare/src/utils/rewriteWasmImportPath.ts | |
parent | 08f6167c012a2c61da5055f350acdf62a8b12b8f (diff) | |
download | astro-8ef3050f1461bb824f095af5157624bfb68ef63c.tar.gz astro-8ef3050f1461bb824f095af5157624bfb68ef63c.tar.zst astro-8ef3050f1461bb824f095af5157624bfb68ef63c.zip |
feat(cloudflare): major refactor for v10 (#159)
Co-authored-by: Matthew Phillips <361671+matthewp@users.noreply.github.com>
Co-authored-by: Emanuele Stoppa <602478+ematipico@users.noreply.github.com>
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Diffstat (limited to 'packages/integrations/cloudflare/src/utils/rewriteWasmImportPath.ts')
-rw-r--r-- | packages/integrations/cloudflare/src/utils/rewriteWasmImportPath.ts | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/packages/integrations/cloudflare/src/utils/rewriteWasmImportPath.ts b/packages/integrations/cloudflare/src/utils/rewriteWasmImportPath.ts deleted file mode 100644 index c266f19b1..000000000 --- a/packages/integrations/cloudflare/src/utils/rewriteWasmImportPath.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { basename } from 'node:path'; -import type esbuild from 'esbuild'; - -/** - * - * @param relativePathToAssets - relative path from the final location for the current esbuild output bundle, to the assets directory. - */ -export function rewriteWasmImportPath({ - relativePathToAssets, -}: { - relativePathToAssets: string; -}): esbuild.Plugin { - return { - name: 'wasm-loader', - setup(build) { - build.onResolve({ filter: /.*\.wasm.mjs$/ }, (args) => { - const updatedPath = [ - relativePathToAssets.replaceAll('\\', '/'), - basename(args.path).replace(/\.mjs$/, ''), - ].join('/'); - - return { - path: updatedPath, - external: true, // mark it as external in the bundle - }; - }); - }, - }; -} |