Skip to content

Commit 3b5ee7f

Browse files
authored
fix(createTestServer): fix the .js MIME type (#27)
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.
1 parent d3d80fd commit 3b5ee7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

createTestServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export async function createTestServer( {
145145
const validMimeTypes = {
146146

147147
// No .mjs or .cjs files are used in tests
148-
".js": "application/javascript",
148+
".js": "text/javascript",
149149
".json": "application/json",
150150
".css": "text/css",
151151
".html": "text/html",

0 commit comments

Comments
 (0)