From 37cdaddff9d31c754a9cb5f879edb7a8d5022cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Mon, 1 Dec 2025 21:33:37 +0100 Subject: [PATCH] fix(createTestServer): fix the `.js` MIME type The proper MIME type for JavaScript files is "text/javascript", not "application/javascript". Even though "application/javascript" is on the list of JavaScript MIME types: https://mimesniff.spec.whatwg.org/#javascript-mime-type per: https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages > Servers should use text/javascript for JavaScript resources, in accordance > with Updates to ECMAScript Media Types. Servers should not use other > JavaScript MIME types for JavaScript resources "Updates to ECMAScript Media Types" is the following RFC: https://www.rfc-editor.org/rfc/rfc9239 In section "2. Compatibility" it says: > The most widely supported media type in use is text/javascript; all others > are considered historical and obsolete aliases of text/javascript. --- createTestServer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/createTestServer.js b/createTestServer.js index f6eb531..077a738 100644 --- a/createTestServer.js +++ b/createTestServer.js @@ -145,7 +145,7 @@ export async function createTestServer( { const validMimeTypes = { // No .mjs or .cjs files are used in tests - ".js": "application/javascript", + ".js": "text/javascript", ".json": "application/json", ".css": "text/css", ".html": "text/html",