From b081591c108cf01904db62672f916d4f794f0669 Mon Sep 17 00:00:00 2001 From: Manu MA Date: Wed, 29 Jun 2022 13:16:09 +0100 Subject: [PATCH] fix: vite transform .mjs and .cjs (#698) --- packages/qwik/src/optimizer/src/plugins/plugin.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/qwik/src/optimizer/src/plugins/plugin.ts b/packages/qwik/src/optimizer/src/plugins/plugin.ts index b9e74f2f035..d1359ed359e 100644 --- a/packages/qwik/src/optimizer/src/plugins/plugin.ts +++ b/packages/qwik/src/optimizer/src/plugins/plugin.ts @@ -445,7 +445,7 @@ export function createPlugin(optimizerOptions: OptimizerOptions = {}) { }; } - if (TRANSFORM_EXTS[ext] || pathId.endsWith('.qwik.js')) { + if (TRANSFORM_EXTS[ext] || TRANSFORM_REGEX.test(pathId)) { log(`transform()`, 'Transforming', pathId); let filePath = base; @@ -633,6 +633,8 @@ function removeExtension(id: string) { const TRANSFORM_EXTS: { [ext: string]: boolean } = { '.jsx': true, '.ts': true, '.tsx': true }; +const TRANSFORM_REGEX = /\.qwik\.(m|c)?js$/; + export const QWIK_CORE_ID = '@builder.io/qwik'; export const QWIK_BUILD_ID = '@builder.io/qwik/build';