We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am using Shiki now, but I can't config target environment over ES2020
// contentlayer.config.ts import rehypeShiKi from '@shikijs/rehype/core'; import { defineDocumentType, makeSource } from 'contentlayer2/source-files'; import rehypeKaTeX from 'rehype-katex'; import remarkGFM from 'remark-gfm'; import remarkMath from 'remark-math'; import { createHighlighter } from 'shiki'; export const Post = defineDocumentType(() => ({ name: 'Post', filePathPattern: `**/*.mdx`, contentType: 'mdx', fields: { title: { type: 'string', required: true }, date: { type: 'date', required: true }, }, computedFields: { url: { type: 'string', resolve: (post: { _raw: { flattenedPath: string } }) => `/post/${post._raw.flattenedPath}`, }, }, })); const highlighter = await createHighlighter({ langs: ['html', 'css', 'js'], themes: ['github-dark', 'github-light'], }); export default makeSource({ contentDirPath: 'src/post', documentTypes: [Post], mdx: { rehypePlugins: [rehypeKaTeX, [rehypeShiKi, highlighter]], remarkPlugins: [remarkMath, [remarkGFM, {}]], }, });
// tsconfig.json { "compilerOptions": { "target": "ESNext", "lib": [ "dom", "dom.iterable", "esnext" ], "baseUrl": ".", "allowJs": true, "skipLibCheck": true, "strict": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", "incremental": true, "plugins": [ { "name": "next" } ], "paths": { "@/*": [ "./src/*" ], "@/components/*": [ "./src/components/*" ], "contentlayer/generated": [ "./.contentlayer/generated" ] } }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".contentlayer/generated" ], "exclude": [ "node_modules" ] }
// yarn dev UnknownEsbuildError: Error: Build failed with 1 error: contentlayer.config.ts:25:20: ERROR: Top-level await is not available in the configured target environment ("es2020") KnownEsbuildError: [ { "id": "", "location": { "column": 20, "file": "contentlayer.config.ts", "length": 5, "line": 25, "lineText": "const highlighter = await createHighlighter({", "namespace": "", "suggestion": "" }, "notes": [], "pluginName": "", "text": "Top-level await is not available in the configured target environment (\"es2020\")" } ]
The text was updated successfully, but these errors were encountered:
Currently, the plugin sets esbuild to target es2020:
es2020
contentlayer2/packages/@contentlayer/core/src/getConfig/index.ts
Line 74 in 395f7ce
ESNext
Sorry, something went wrong.
No branches or pull requests
Issue
I am using Shiki now, but I can't config target environment over ES2020
Files
Error
The text was updated successfully, but these errors were encountered: