lwsjs / local-web-server

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

rewrite rules are not loaded from config file #62

Closed carlfish closed 7 years ago

carlfish commented 7 years ago

node 7.10.0

package.json

{
  "scripts": {
     "ws": "ws"
  },
  "devDependencies": {
     "local-web-server": "^1.2.7"
  }
}

.local-web-server

{
    "rewrite": [
      { "from": "/*", "to": "/dist/$1" }
    ]
}

Running "npm run ws" does not load the rewrite rule.

The problem appears to be in cli.js - the rewrite rules returned by the command-line parser are the empty array [], so the Object.assign that merges the config sources overwrites whatever it loads from the config file with the empty list.

Which is weird, because I am sure this worked a month ago.

75lb commented 7 years ago

damn it.. yes, this worked a month ago - this is caused by a regression in command-line-args v4.0.4.

Will fix it this evening, thanks for the report.

75lb commented 7 years ago

as a workaround, running npm i command-line-args@4.0.3 in whichever folder your local-web-server module is installed should fix it.

carlfish commented 7 years ago

Alternatively, downgrading to 1.2.6 seems to work fine. Thanks for the quick response!

75lb commented 7 years ago

the regression was resolved in command-line-args v4.0.5. Please reinstall local-web-server to pick up the latest deps and fix the issue.

Let me know if you find anything else! Also, i'm working on lws version 2 - now's a good time for any feature requests. Cheers!