Skip to content

Commit

Permalink
Fix build (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvv authored Jan 28, 2025
1 parent 06aecf4 commit 5ef04d6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/worker/transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ module.exports = async function transpile(data) {
if (entry.isDirectory() && entry.name !== "node_modules" && entry.name !== "lib" && entry.name !== "tests" && entry.name !== "dist") {
queue.push(fullPath);
} else if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx"))) {
const dest = fullPath
.replace(/([/\\])src/, "$1lib")
// Only replace src to 'lib' in the project tree.
// The repo could be cloned in a folder with 'src' and we don't want to replace that with 'lib'
const targetRelativePath = path
.relative(target.cwd, fullPath)
.replace("src" + path.sep, "lib" + path.sep)
.replace(".tsx", ".js")
.replace(".ts", ".js");

const dest = path.join(target.cwd, targetRelativePath);
const swcOutput = await swc.transformFile(fullPath, {
...swcOptions,
sourceFileName: path.relative(path.dirname(dest), fullPath).replace(/\\/g, "/"),
Expand Down

0 comments on commit 5ef04d6

Please sign in to comment.