diff options
author | 2022-08-02 14:07:17 -0500 | |
---|---|---|
committer | 2022-08-02 14:07:17 -0500 | |
commit | b60cc0538bc5c68dd411117780d20d892530789d (patch) | |
tree | c539222464778bebe8043026da5a9cae765e1beb /packages/integrations/mdx/src | |
parent | 9cc3a11c44eaf042bb3a982c812e1d8e839faf8f (diff) | |
download | astro-b60cc0538bc5c68dd411117780d20d892530789d.tar.gz astro-b60cc0538bc5c68dd411117780d20d892530789d.tar.zst astro-b60cc0538bc5c68dd411117780d20d892530789d.zip |
Add generic plugin for `page-ssr` injection (#4049)
* feat: add generic page-ssr plugin
* refactor: remove page-specific logic from astro/markdown/mdx plugins
* refactor: revert changes to vite-plugin-scripts
* fix: handle injected `page` scripts in build
* fix: prepend injected `page` scripts with `/@id/` in dev
Co-authored-by: Nate Moore <nate@astro.build>
Diffstat (limited to 'packages/integrations/mdx/src')
-rw-r--r-- | packages/integrations/mdx/src/index.ts | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts index 81187cc60..7a38643aa 100644 --- a/packages/integrations/mdx/src/index.ts +++ b/packages/integrations/mdx/src/index.ts @@ -125,13 +125,6 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration { if (!id.endsWith('.mdx')) return; const [, moduleExports] = parseESM(code); - // This adds support for injected "page-ssr" scripts in MDX files. - // TODO: This should only be happening on page entrypoints, not all imported MDX. - // TODO: This code is copy-pasted across all Astro/Vite plugins that deal with page - // entrypoints (.astro, .md, .mdx). This should be handled in some centralized place, - // or otherwise refactored to not require copy-paste handling logic. - code += `\nimport "${'astro:scripts/page-ssr.js'}";`; - const { fileUrl, fileId } = getFileInfo(id, config); if (!moduleExports.includes('url')) { code += `\nexport const url = ${JSON.stringify(fileUrl)};`; |