We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f50068 commit 83bfe44Copy full SHA for 83bfe44
1 file changed
packages/integrations/markdoc/src/index.ts
@@ -1,4 +1,5 @@
1
import type { AstroIntegration } from 'astro';
2
+import type { InlineConfig } from 'vite';
3
4
export default function markdoc(partialOptions: {} = {}): AstroIntegration {
5
return {
@@ -7,6 +8,19 @@ export default function markdoc(partialOptions: {} = {}): AstroIntegration {
7
8
'astro:config:setup': async ({ updateConfig, config, addPageExtension, command }: any) => {
9
addPageExtension('.mdoc');
10
console.log('Markdoc working!');
11
+
12
+ const viteConfig: InlineConfig = {
13
+ plugins: [
14
+ {
15
+ name: '@astrojs/markdoc',
16
+ async transform(code, id) {
17
+ if (!id.endsWith('.mdoc')) return;
18
+ return `export const body = ${JSON.stringify(code)}`;
19
+ },
20
21
+ ],
22
+ };
23
+ updateConfig({ vite: viteConfig });
24
},
25
26
};
0 commit comments