Parcel –public-url ./ doesn’t support scripts and links in subfolders

🐛 bug report

I have following file tree:

│   index.html
│
├───donate
│       step-1.html
│       step-2.html
│
├───scripts
│       main.js
│
└───styles
        main.css

The step-1.html and step-2.html are both linking to the main.js and main.css. In order to get to that path I have to use ../scripts/main.js and ../styles/main.css to access them. But when bundling them with parcel using following command parcel build index.html --public-url ./ , parcel bundles the output as if they are in the same folder. Anchor tags, however, are working fine.

🎛 Configuration (.babelrc, package.json, cli command)

Zero config

🤔 Expected Behavior

Parcel should bundle to the correct paths

😯 Current Behavior

Parcel bundles to the root path for scripts and links

💻 Code Sample

A full working example can be seen here:
https://github.com/advename/Parcel-error-example/tree/master

🌍 Your Environment

Software Version(s)
Parcel 1.9.7
Node 8.11.2
npm/Yarn 5.6.0
Operating System Windows 10 64-bit Pro

2 thoughts on “Parcel –public-url ./ doesn’t support scripts and links in subfolders