yandeu / five-server

⚡ Development Server with Live Reload Capability. (Maintained Fork of Live Server)
https://www.npmjs.com/package/five-server
Other
162 stars 14 forks source link

Mount option via command line is not working properly? #139

Open DrKGD opened 3 months ago

DrKGD commented 3 months ago

Describe the bug Can't really mount a directory via the --mount command line argument

five-server --port=60200 --mount=/img:./images
drwxr-xr-x - deatharte 26 Jun 22:18 images
/usr/lib/node_modules/five-server/lib/bin.js:142
            opts.mount.push([match[1], match[2]]);
                       ^
TypeError: Cannot read properties of undefined (reading 'push')
    at Object.<anonymous> (/usr/lib/node_modules/five-server/lib/bin.js:142:24)
    at Module._compile (node:internal/modules/cjs/loader:1460:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
    at Module.load (node:internal/modules/cjs/loader:1275:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
    at node:internal/main/run_main_module:30:49

Node.js v22.3.0

I suspect opts.mount is undefined? opts.proxy may also be affected by same the issue.

https://github.com/yandeu/five-server/blob/594fb7f0a6bfe422c7b978494f62542f51514b69/src/bin.ts#L111-L120