File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,14 @@ module.exports = async function transpile(data) {
28
28
if ( entry . isDirectory ( ) && entry . name !== "node_modules" && entry . name !== "lib" && entry . name !== "tests" && entry . name !== "dist" ) {
29
29
queue . push ( fullPath ) ;
30
30
} else if ( entry . isFile ( ) && ( entry . name . endsWith ( ".ts" ) || entry . name . endsWith ( ".tsx" ) ) ) {
31
- const dest = fullPath
32
- . replace ( / ( [ / \\ ] ) s r c / , "$1lib" )
31
+ // Only replace src to 'lib' in the project tree.
32
+ // The repo could be cloned in a folder with 'src' and we don't want to replace that with 'lib'
33
+ const targetRelativePath = path
34
+ . relative ( target . cwd , fullPath )
35
+ . replace ( "src" + path . sep , "lib" + path . sep )
33
36
. replace ( ".tsx" , ".js" )
34
37
. replace ( ".ts" , ".js" ) ;
35
-
38
+ const dest = path . join ( target . cwd , targetRelativePath ) ;
36
39
const swcOutput = await swc . transformFile ( fullPath , {
37
40
...swcOptions ,
38
41
sourceFileName : path . relative ( path . dirname ( dest ) , fullPath ) . replace ( / \\ / g, "/" ) ,
You can’t perform that action at this time.
0 commit comments