I was trying to use Ecstatic (via http-server) to serve Angular's ES2015 modules. This means serving with .js default extension. I had problems because they have some files named e.g. metadata.js that also have a corresponding directory with the same name. Attempting to import ./metadata resolves to the directory, but since there is no index.js inside it, and showDir is false, this results in a 404. In this case, I think Ecstatic should fall back to serving the document with the default extension, if one exists.
I.e the proposed logic would be this:
- If a file with the exact path exists: Serve it.
- Else if a directory with the exact path exists:
- If the directory has an index document: Serve it.
- Else if the
showDir: true: Show file list.
- Else if a file with default extension exists: Serve it.
- Else if 404.html exists: Serve it.
- Else serve 404.
I was trying to use Ecstatic (via http-server) to serve Angular's ES2015 modules. This means serving with
.jsdefault extension. I had problems because they have some files named e.g.metadata.jsthat also have a corresponding directory with the same name. Attempting to import./metadataresolves to the directory, but since there is noindex.jsinside it, andshowDirisfalse, this results in a 404. In this case, I think Ecstatic should fall back to serving the document with the default extension, if one exists.I.e the proposed logic would be this:
showDir: true: Show file list.