Skip to content

Commit 1146ed8

Browse files
committed
minor fix
1 parent 0892de8 commit 1146ed8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/lib/ignoreassets/index.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ export default function (extensions: string[]): AstroIntegration {
6969
".mkd",
7070
".mdwn",
7171
".md",
72-
// ".mdx" is added by @astrojs/mdx integration through addPageExtension(), but
73-
// there is no way to peek the current value of AstroSettings.pageExtensions.
74-
".mdx",
75-
] as const;
72+
];
7673

7774
let filesInPages: Map<
7875
string,
@@ -82,14 +79,23 @@ export default function (extensions: string[]): AstroIntegration {
8279
}
8380
>;
8481

85-
let pagesDir = "";
82+
let pagesDir: string;
8683

8784
async function configSetupHook(options: {
8885
config: AstroConfig;
8986
updateConfig: (_: Partial<AstroConfig>) => unknown;
9087
}): Promise<void> {
9188
pagesDir = fileURLToPath(new URL("./pages", options.config.srcDir));
9289

90+
if (
91+
options.config.integrations.findIndex((i) => i.name === "@astrojs/mdx") <
92+
0
93+
) {
94+
// ".mdx" is added by @astrojs/mdx integration through addPageExtension(), but
95+
// there is no way to peek the current value of AstroSettings.pageExtensions.
96+
pageExtensions.push(".mdx");
97+
}
98+
9399
insertPageExtensions(options, extensions);
94100

95101
filesInPages = new Map(

0 commit comments

Comments
 (0)