[vite:esbuild-transpile] Transform failed with 3 errors:
chunks/site-metadata-207b96de.js:118:17: error: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
chunks/site-metadata-207b96de.js:126:17: error: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
chunks/site-metadata-207b96de.js:134:22: error: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
116| };
117|
118| socialsStore.set(await fetchSocials());
| ^
119|
120| const fetchAuthors = async () => {
Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
124| };
125|
126| authorsStore.set(await fetchAuthors());
| ^
127|
128| const fetchSiteMetadata = async () => {
Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
132| };
133|
134| siteMetadataStore.set(await fetchSiteMetadata());
| ^
135|
136| export { authorsStore as a, authorsQuery as b, client as c, siteMetadataStore as d, articleQuery as e, projectQuery as f, projectsQuery as p, socialsStore as s };
import adapter from '@sveltejs/adapter-auto'
import path from 'path'
import preprocess from 'svelte-preprocess'
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter(),
vite: {
ssr: {
external: ['whatwg-url'],
},
resolve: {
alias: {
$components: path.resolve('./src/lib/components'),
$lib: path.resolve('./src/lib'),
$stores: path.resolve('./src/stores'),
},
},
},
},
preprocess: [
preprocess({
postcss: true,
}),
],
}
export default config
ssr: {
external: ['whatwg-url'],
},
Severity: high with no workaround. I changed the above code to:
import { client } from '$lib/graphql-client'
import {
authorsQuery,
siteMetadataQuery,
socialsQuery,
} from '$lib/graphql-queries'
import { writable } from 'svelte/store'
export const socialsStore = writable({})
export const authorsStore = writable({})
export const siteMetadataStore = writable({})
const fetchSocials = async () => {
const { socials } = await client.request(socialsQuery)
return socials[0]
}
fetchSocials().then(output => socialsStore.set(output))
const fetchAuthors = async () => {
const { authors } = await client.request(authorsQuery)
return authors[0]
}
fetchAuthors().then(output => authorsStore.set(output))
const fetchSiteMetadata = async () => {
const { projectMetadatas } = await client.request(siteMetadataQuery)
return projectMetadatas[0]
}
fetchSiteMetadata().then(output => siteMetadataStore.set(output))
(node:438) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)```