diff --git a/lib/middleware/karma.js b/lib/middleware/karma.js
index 88e438112..cabeb2f81 100644
--- a/lib/middleware/karma.js
+++ b/lib/middleware/karma.js
@@ -193,7 +193,7 @@ function createKarmaMiddleware (
} else {
const scriptType = (SCRIPT_TYPE[fileType] || 'text/javascript')
const crossOriginAttribute = includeCrossOriginAttribute ? 'crossorigin="anonymous"' : ''
- if (scriptType === 'module') {
+ if (fileType === 'module') {
scriptTags.push(``)
} else {
scriptTags.push(``)