Skip to content

Commit

Permalink
Fix extensions (BuilderIO#992)
Browse files Browse the repository at this point in the history
* fix extensions

* remove log
  • Loading branch information
samijaber authored Jan 20, 2023
1 parent c6b0946 commit f3652f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 4 additions & 3 deletions packages/cli/src/build/helpers/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ export const getFileExtensionForTarget = ({
return '.ts';
case 'lit':
return '.ts';

// all JSX frameworks
case 'solid':
case 'qwik':
return isTs && type === 'filename' ? '.tsx' : '.jsx';
case 'react':
case 'reactNative':
case 'rsc':
switch (type) {
// we can't have `.jsx`/`.tsx` extensions in the import paths.
case 'import':
return isTs ? '.ts' : '.js';
// we can't have `.jsx`/`.tsx` extensions in the import paths, so we stick with implicit file extensions.
return '';
case 'filename':
return isTs ? '.tsx' : '.jsx';
}
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/helpers/replace-identifiers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ const TEST_SPECS: Spec[] = [
const bar = foo;
`,
from: ['foo', 'test'],
to: (name) => {
console.log({ name });
return `${name}.value`;
},
to: (name) => `${name}.value`,
},
];

Expand Down

0 comments on commit f3652f7

Please sign in to comment.