Skip to content

Commit

Permalink
fix: vite transform .mjs and .cjs (#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored Jun 29, 2022
1 parent ea02ef2 commit b081591
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/qwik/src/optimizer/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit b081591

Please sign in to comment.