Node.js recognizes .mjs as an ES6 module and .cjs as a CommonJS module. Other web servers e.g. in other languages recognize them as well. This change makes the resource handlers in Spring Web work the same with .mjs as .js.

Example with Python:

$ curl -v localhost:8000/hello.mjs > /dev/null
...
< Content-type: application/javascript
< Content-Length: 825
< Last-Modified: Tue, 15 Mar 2022 11:00:54 GMT
< 

Comment From: bclozel

It looks like the Python dev server is only registering the *.mjs extension and is relying on known files for the rest. This server is meant for development only and not for production usage. Well-known servers such as nginx, httpd or Tomcat do not support those extensions.

Given that registering additional extensions is quite easy, I don't think we should add those entries here. The main goal here is to remain in sync with those well-known servers, so I'm declining this PR as a result.

Thanks!