[Bug 294375] www/nginx: mime.types missing mjs extension for JavaScript ES modules

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 10 Apr 2026 00:36:19 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294375

            Bug ID: 294375
           Summary: www/nginx: mime.types missing mjs extension for
                    JavaScript ES modules
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: joneum@FreeBSD.org
          Reporter: scott@wirthmgt.com
          Assignee: joneum@FreeBSD.org
             Flags: maintainer-feedback?(joneum@FreeBSD.org)

The nginx port ships a mime.types file that does not include the .mjs extension
for JavaScript ES modules. Without this mapping, nginx serves .mjs files as
application/octet-stream, causing browsers to refuse to execute them as
JavaScript modules with the error:

"Failed to load module script: Expected a JavaScript module script but the
server responded with a MIME type of application/octet-stream."

ES modules (.mjs) are the standard JavaScript module format, defined in the
ECMAScript specification and supported by all modern browsers and Node.js. The
.mjs extension is widely used to distinguish ES modules from CommonJS modules.

Nextcloud's ExApp framework uses .mjs files and requires this mapping to
function correctly. Any FreeBSD nginx user serving modern JavaScript
applications will encounter this issue.

The fix is a one-line change to /usr/local/etc/nginx/mime.types:

    application/javascript    js mjs;

Note: This fix needs to be applied at the port level. The nginx upstream
project was contacted and confirmed they consider mime.types frozen and will
not accept new types upstream (https://github.com/nginx/nginx/pull/1259).

-- 
You are receiving this mail because:
You are the assignee for the bug.