Skip to content
New issue

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

🐛 BUG: Redundant and incorrect script tag in compiled markdown pages with script in md source. #3254

Closed
florian-s-code opened this issue May 1, 2022 · 0 comments · Fixed by #3410
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: markdown Related to Markdown (scope)

Comments

@florian-s-code
Copy link
Contributor

florian-s-code commented May 1, 2022

What version of astro are you using?

v1.0.0-beta.20

Are you using an SSR adapter? If so, which one?

No

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

When using a script tag in an .md page, a redundant and incorrect script tag will appear in the compiled html.
This redundant script tag has its src attribute exactly as it was written in the markdown file. In the final build this path might not point to a file as the file is bundled under a totally different name (entry.xxx.js).

It looks like the Astro compiler/bundler does not correctly remove the original script tag when generating a new one for the bundled js.

It only causes an unnecessary request that returns 404 due to the redundant script tag, the script is in fact bundled correctly in "/entry.157e459c.js" and executes correctly.

Reproduction:

  • Visit stackblitz URL.
  • Run npm run build
  • Check the generated dist/test/index.html (compiled from src/pages/test.md)
  • Notice the redundant script tag (with src="/src/scripts/test.js") that should have been replaced by the astro generated script tag (with src="/entry.157e459c.js")

Link to Minimal Reproducible Example

https://stackblitz.com/github/florian-s-code/astro_tests/tree/main/md_compile

Direct link to github repo for local tests: https://github.com/florian-s-code/astro_tests/tree/main/md_compile (same one as in the stackblitz)

Participation

  • [] I am willing to submit a pull request for this issue.

I have looked at the markdown pipeline but it might happen later in the process, after the markdown has been transformed to an astro component. I was not sure where to investigate.

@natemoo-re natemoo-re added feat: markdown Related to Markdown (scope) - P3: minor bug An edge case that only affects very specific usage (priority) s2-medium and removed bb:investigate - P3: minor bug An edge case that only affects very specific usage (priority) labels May 10, 2022
@natemoo-re natemoo-re linked a pull request May 19, 2022 that will close this issue
@natemoo-re natemoo-re self-assigned this May 19, 2022
natemoo-re added a commit that referenced this issue May 24, 2022
* feat: use internal MDX tooling for markdown + components

* fix: improve MD + component tests

* chore: add changeset

* fix: make tsc happy

* fix(#3319): add regression test for component children

* fix(markdown): support HTML comments in markdown

* fix(#2474): ensure namespaced components are properly handled in markdown pages

* fix(#3220): ensure html in markdown pages does not have extra surrounding space

* fix(#3264): ensure that remark files pass in file information

* fix(#3254): enable experimentalStaticExtraction for `.md` pages

* fix: revert parsing change

* fix: remove `markdown.mode` option
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this issue Feb 3, 2023
* feat: use internal MDX tooling for markdown + components

* fix: improve MD + component tests

* chore: add changeset

* fix: make tsc happy

* fix(withastro#3319): add regression test for component children

* fix(markdown): support HTML comments in markdown

* fix(withastro#2474): ensure namespaced components are properly handled in markdown pages

* fix(withastro#3220): ensure html in markdown pages does not have extra surrounding space

* fix(withastro#3264): ensure that remark files pass in file information

* fix(withastro#3254): enable experimentalStaticExtraction for `.md` pages

* fix: revert parsing change

* fix: remove `markdown.mode` option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: markdown Related to Markdown (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants