Parceljs Issue. Dev mode OK. Prod build Not OK

So I’m testing out Parceljs.

The dev mode is working perfectly. My file structure is dead simple, just for testing.

/src/index.html
/src/index.css
/src/index.js

and just to summarize the code:

index.html

 <script src="./index.js" async defer></script>
 <h1>Hello World!</h1>
 <div id="app"></div>

index.css

body {
  background-color: lightskyblue;
}

index.js

const div = document.getElementById("app");

div.textContent = `hey`;

package.json

{
  "name": "parceltest1",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "parcel ./src/index.html",
    "build": "parcel build ./src/index.html"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "parcel-bundler": "^1.12.4"
  }
}

So like i said everything’s perfect on dev mode. But the build (prod & dev) in the /dist folder, when I run live server on the index.html. the css and the js codes aren’t working.

Pretty sure it’s expected that the dist folder be in the root (/). You can set the public URL to serve on using --public-url. You likely also have to serve it up. Try moving the dist folder to the root and then use something like Live Server to serve it.

I’m guessing it would work just fine if uploaded to a server.

Yes, I think you’re right. This issue came up a couple of weeks ago with another camper: