Skip to content

Commit

Permalink
Pass pathname into the markdown plugin as well
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Dec 28, 2021
1 parent b61577b commit c8c3e8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion packages/astro/src/vite-plugin-build-html/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ export function rollupPluginAstroBuildHTML(options: PluginOptions): VitePlugin {
if (!allInputs.size) {
allInputs.add(ASTRO_EMPTY);
}
console.log("ALL INPUTS", allInputs)
const outOptions = addRollupInput(inputOptions, Array.from(allInputs));
return outOptions;
},
Expand Down
4 changes: 4 additions & 0 deletions packages/astro/src/vite-plugin-markdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ ${setup}`.trim();
astroResult = `${prelude}\n${astroResult}`;
}

const filenameURL = new URL(`file://${id}`);
const pathname = filenameURL.pathname.substr(config.projectRoot.pathname.length - 1);

// Transform from `.astro` to valid `.ts`
let { code: tsResult } = await transform(astroResult, {
pathname,
projectRoot: config.projectRoot.toString(),
site: config.buildOptions.site,
sourcefile: id,
Expand Down

0 comments on commit c8c3e8d

Please sign in to comment.