withastro / docs

Astro documentation
https://docs.astro.build/
MIT License
1.3k stars 1.45k forks source link

gitaction error,cant change es2022 version #6789

Closed HxSay closed 7 months ago

HxSay commented 7 months ago

error Top-level await is not available in the configured target environment ("es2020") File: dist/chunks/pages/记一次Java项目线上线程耗尽的问题排查.md.3257850c.mjs:11:35 Code: 1635 | }).join("");

1636 | let error = new Error(${text}${summary}); | ^ 1637 | error.errors = errors; 1638 | error.warnings = warnings; 1639 | return error; Stacktrace: Error: Build failed with 8 errors: dist/chunks/pages/记一次Java项目线上线程耗尽的问题排查.md.3257850c.mjs:11:35: ERROR: Top-level await is not available in the configured target environment ("es2020") dist/chunks/pages/记一次Java项目线上线程耗尽的问题排查.md.3257850c.mjs:11:57: ERROR: Top-level await is not available in the configured target environment ("es2020") dist/chunks/pages/记一次Java项目线上线程耗尽的问题排查.md.3257850c.mjs:11:204: ERROR: Top-level await is not available in the configured target environment ("es2020") dist/chunks/pages/记一次Java项目线上线程耗尽的问题排查.md.3257850c.mjs:11:226: ERROR: Top-level await is not available in the configured target environment ("es2020") dist/chunks/pages/记一次Java项目线上线程耗尽的问题排查.md.3257850c.mjs:11:373: ERROR: Top-level await is not available in the configured target environment ("es2020") ... at failureErrorWithLog (/home/runner/work/HxSayBlogs/HxSayBlogs/node_modules/esbuild/lib/main.js:1636:15) at /home/runner/work/HxSayBlogs/HxSayBlogs/node_modules/esbuild/lib/main.js:1048:25 at /home/runner/work/HxSayBlogs/HxSayBlogs/node_modules/esbuild/lib/main.js:993:52 at buildResponseToResult (/home/runner/work/HxSayBlogs/HxSayBlogs/node_modules/esbuild/lib/main.js:1046:7) at /home/runner/work/HxSayBlogs/HxSayBlogs/node_modules/esbuild/lib/main.js:1075:16 at responseCallbacks. (/home/runner/work/HxSayBlogs/HxSayBlogs/node_modules/esbuild/lib/main.js:697:9) at handleIncomingPacket (/home/runner/work/HxSayBlogs/HxSayBlogs/node_modules/esbuild/lib/main.js:752:9) at Socket.readFromStdout (/home/runner/work/HxSayBlogs/HxSayBlogs/node_modules/esbuild/lib/main.js:673:7) at Socket.emit (node:events:517:28) at addChunk (node:internal/streams/readable:368:12)

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Error: Process completed with exit code 1.

HxSay commented 7 months ago

//astro.config.mjs import { defineConfig } from "astro/config"; import tailwind from "@astrojs/tailwind"; import react from "@astrojs/react"; import partytown from "@astrojs/partytown"; import sitemap from "@astrojs/sitemap"; import remarkGfm from "remark-gfm"; import remarkBreaks from "remark-breaks"; import rehypeSlug from "rehype-slug"; import rehypeAutolinkHeadings from "rehype-autolink-headings";

// https://astro.build/config export default defineConfig({ site: "https://genexu.github.io", integrations: [ tailwind(), react(), partytown({ config: { forward: ["dataLayer.push"], }, }), sitemap({ i18n: { defaultLocale: "zh-tw", locales: { "zh-tw": "zh-TW", en: "en-US", }, }, }), ], markdown: { // https://docs.astro.build/en/guides/markdown-content/#markdown-plugins // https://docs.astro.build/en/guides/markdown-content/#customizing-a-plugin remarkPlugins: [remarkGfm, remarkBreaks], rehypePlugins: [ rehypeSlug, [ rehypeAutolinkHeadings, { behavior: "append", properties: { className: ["anchor"], }, content: { type: "element", tagName: "span", // properties: { // className: ["icon", "icon-link"], // }, children: [ { type: "text", value: "#", }, ], }, }, ], ], shikiConfig: { // Choose from Shiki's built-in themes (or add your own) // https://github.com/shikijs/shiki/blob/main/docs/themes.md theme: "dracula", // Add custom languages // Note: Shiki has countless langs built-in, including .astro! // https://github.com/shikijs/shiki/blob/main/docs/languages.md langs: [], // Enable word wrap to prevent horizontal scrolling wrap: false, }, }, vite: { ssr: { noExternal: ["react-icons"], }, }, });

HxSay commented 7 months ago

//gitpages.yml

name: Deploy Astro site to Pages

on: push: branches: ["main"]

Allows run this workflow manually from the Actions tab

workflow_dispatch:

permissions: contents: read pages: write # To deploy to Pages id-token: write # To verify the deployment originates from an appropriate source

Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.

However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.

concurrency: group: "pages" cancel-in-progress: false

env: BUILD_PATH: "."

jobs: build: name: Build runs-on: ubuntu-latest steps:

TheOtterlord commented 7 months ago

Welcome to docs @HxSay!

If you're having issues with GitHub pages, the best place to get help is the Astro Discord. If you've found something broken specifically with the documentation, filling out our issue template helps let us know exactly what's wrong. I'll close this issue as is for now as there's nothing to act on.