marko-js / marko-js/run

Bug: <script> tags with relative path in `src` get the file contents placed in `src` on build

Open
#65 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. Create a new Run project

  2. Create a src/routes/test.js file

    export default "the script content";
    
  3. Add <script src="./test.js"></script> to +layout.marko

    image
  4. Build

This is easier to see when using the static adapter...

image

But it happens with the default adapter too

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.