Bug: <script> tags with relative path in `src` get the file contents placed in `src` on build
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 175
- Forks
- 17
- Avg merge
- 5h 26m
- Merged PRs (30d)
- 5
Description
What's happening
A script tag with a relativesrc path like <script src="./test.js"></script>
gets compiled into <script src="[CONTENTS OF test.js]"></script>
NOTE: That does not happen with absolute paths: /js/script.js or full URLs
Expected Behavior
Marko does nothing and the script tag remains "as is". I was caught totally by surprise that Marko/Run was doing anything at all with something I considered "plain html".
Ok, nothing in Marko is plain HTML... but usually boundaries and side effects are clear. In this case, I don't know what's going on here.
How to reproduce:
-
Create a new Run project
-
Create a
src/routes/test.jsfileexport default "the script content"; -
Add
<script src="./test.js"></script>to+layout.marko -
Build
This is easier to see when using the static adapter...
But it happens with the default adapter too
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in a new Run project with src/routes/test.js and the script tag in +layout.marko, then compare build output for relative, absolute, and full-URL src values. Check the build path used by the static adapter and default adapter. Done means relative script src values remain unchanged in both adapters, with coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100