parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.49k stars 2.27k forks source link

404 in lazy mode #6679

Open GauBen opened 3 years ago

GauBen commented 3 years ago

🐛 bug report

Nested directories throw 404 error pages in lazy mode, and works well in non lazy mode.

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

package.json

{
  "scripts": {
    "start": "yarn clean && yarn build:eleventy && npm-run-all --parallel 'watch:*'",
    "watch:eleventy": "eleventy --watch",
    "watch:parcel": "parcel '.pre-dist/**/*.{html,xml}' --dist-dir .dist --lazy",
    "clean": "rimraf ./.dist ./.pre-dist",
    "build:eleventy": "eleventy"
  }
}

🤔 Expected Behavior

The page should load

😯 Current Behavior

image

💁 Possible Solution

Current workaround: remove --lazy.

💻 Code Sample

The repo/commit where I discovered this bug: https://github.com/GauBen/gauben.github.io/commit/39e2aa514d7097063744618c6fed8046f44478b3

Clone the repo and install dependencies

git clone https://github.com/GauBen/gauben.github.io.git --depth 20
cd gauben.github.io
git checkout 39e2aa514d7097063744618c6fed8046f44478b3
yarn

Here are two reproducible (I hope) failing tests:

  1. yarn start
  2. Open http://localhost:1234/
  3. Open http://localhost:1234/about/
  4. Open http://localhost:1234/fr/about/
  5. 404 Page not found
  6. Ctrl+C

  1. yarn start
  2. Open http://localhost:1234/fr/about/
  3. Open http://localhost:1234/
  4. Broken CSS
  5. Ctrl+C

If no one can reproduce the bugs, I'll try to setup a basic Cypress workflow

🌍 Your Environment

Software Version(s)
Parcel 2-rc.0
Node 16.6.1
npm/Yarn yarn 3
Operating System WSL
devongovett commented 3 years ago

Thanks for reporting. --lazy is still a bit early (hence the flag). We'll take a look!

Offirmo commented 2 years ago

Hi, I'm trying parcel on a very simple repo and I'm having big problems with parcel serve. I tried to remove the --lazy option but I still have issues of the wrong page served when loading another page, etc. It's super annoying and makes me doubt the quality of parcel :(