lwsjs / local-web-server

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

Configured mime types are not used #144

Closed Toastgeraet closed 4 years ago

Toastgeraet commented 4 years ago

Hey, i created a lws.config.js to customize mime types, because my browser wont load javascript files: it complain about the mime type being text/plain.

Now the config output by 'ws --config' looks fine, but when tested in browser, the local web server still returns 'text/plain' for .js files.

{
  port: 8000,
  moduleDir: [
    '.',
    'C:\\Users\\xxxxx\\AppData\\Roaming\\npm\\node_modules\\local-web-server'
  ],
  modulePrefix: 'lws-',
  stack: MiddlewareStack(15) [
    BasicAuth,      BodyParser,
    RequestMonitor, Log,
    Cors,           Json,
    Compress,       Rewrite,
    Blacklist,      ConditionalGet,
    Mime,           Range,
    SPA,            Static,
    Index
  ],
  mime: { 'application/javascript': [ 'js', 'mjs' ] },
  view: CliView {}
}
75lb commented 4 years ago

This is strange. By default, local-web-server will return the correct MIME type for Javascript (application/javascript). If it did not, thousands of people would be reporting a bug - including myself.

Please post a full reproduction case - code and commands I can run to see this issue failing for myself.

75lb commented 4 years ago

Closing for now as stale.