lwsjs / local-web-server

A lean, modular web server for rapid full-stack development.
MIT License
1.2k stars 85 forks source link

spa and stack not working together in command line #92

Closed maxorlovsky closed 6 years ago

maxorlovsky commented 6 years ago

Trying to run --spa with --stack from command line will return an error

$ node_modules/.bin/ws --spa --stack redirect-everything.js
UNKNOWN_OPTION: Unknown option: --spa
    at commandLineArgs (/var/www/sfww/node_modules/command-line-args/index.js:59:21)
    at WsServe.getOptions (/var/www/sfww/node_modules/lws/lib/command/serve.js:260:18)
    at WsServe.execute (/var/www/sfww/node_modules/lws/lib/command/serve.js:271:20)
    at WsServe.execute (/var/www/sfww/node_modules/local-web-server/lib/command/serve.js:16:18)
    at Map.start (/var/www/sfww/node_modules/cli-commands/index.js:26:18)
    at WsCliApp.start (/var/www/sfww/node_modules/lws/lib/cli-app.js:11:34)
    at Function.run (/var/www/sfww/node_modules/lws/lib/cli-app.js:23:21)
    at Object.<anonymous> (/var/www/sfww/node_modules/local-web-server/bin/cli.js:12:29)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
75lb commented 6 years ago

--spa is an option defined by the lws-spa middleware. If you run ws --config in a folder without lws.config.js you will see 'Spa' (exported by the module lws-spa) is included in the default middleware stack.

If you remove lws-spa from the stack (by supplying your own --stack which does not include it), you'll lose all spa options including --spa.