-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add keepNames esbuild option #148
Comments
I'm having this same issue too with my grandma's TV app (it's secretly a website, don't tell her). Works fine on dev and prod builds locally, but throws this same error regardless of my vite config, both for terser and esbuild, when trying to add a logging feature that fetches a file from Azure Storage https://black-mushroom-06e3d7310-50.centralus.3.azurestaticapps.net/ask import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vitest/config";
export default defineConfig({
plugins: [sveltekit()],
build: {
minify: "terser",
terserOptions: {
mangle: false,
sourceMap: true,
compress: false,
keep_classnames: /AbortSignal/,
keep_fnames: /AbortSignal/,
output: {
comments: false
}
}
},
//... |
PR adding I can make the PR myself when I have time, but it might be a few days |
I just remembered that I also ran into this issue when using some azure sdk package for my app. The take away from that thread is that the issue is really solved, but some non-ESM packages still have it, because it's only available on the ESM versions of node-fetch. Particularily, some Azure packages are using these old versions. I think I worked around the issue by avoiding that problematic package and updating some other packages to pre-release versions. An alternative fix to |
You can now set // svelte.config.js
import azure from 'svelte-adapter-azure-swa';
export default {
kit: {
adapter: azure({
esbuildOptions: {
keepNames: true
}
})
}
}; |
When building an application (with
node-fetch
as an external dependency) for production or local testing viaswa start
, the runtime errorTypeError: Expected signal to be an instanceof AbortSignal
comes up. This can be fixed by setting the esbuild optionkeepNames
to true, though the adapter does not seem to take that option into account unless I'm mistaken.svelte.config.js
I have also tried setting the options in
vite.config.ts
, but to no availThis is in reference to an existing issue in this repo: #56
Further documentation on the issue, with the recommendation to set
keepNames
to true in order to fix the runtime error: node-fetch/node-fetch#784For the time being, the only way to avoid this error is to comment out the line throwing the error in the generated
build/server/sk_render/index.js
Minimum repro: https://github.com/fredgig/sveltekit-azure-repro
npm run build
swa start
throw new TypeError("Expected signal to be an instanceof AbortSignal");
at line37296
inbuild/server/sk_render/index.js
The text was updated successfully, but these errors were encountered: