-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: replace tsx
with swc
#487
Conversation
@@ -12,7 +12,7 @@ | |||
"clean": "rm -rf ./dist", | |||
"typecheck": "tsc --noEmit && tsc -p test/tsconfig.json --noEmit", | |||
"prepublishOnly": "pnpm clean && pnpm build && chmod +x ./dist/bin/cli.js && pnpm test", | |||
"build": "tsx ./src/bin/index.ts --runtime node", | |||
"build": "SWC_NODE_IGNORE_DYNAMIC=true node -r @swc-node/register ./src/bin/index.ts --runtime node", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SWC_NODE_IGNORE_DYNAMIC
is introduced in swc-project/swc-node#745.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's fine to not pass SWC_NODE_IGNORE_DYNAMIC=true
, as core package will be bundled as require("bunchee")
and we also don't have dynamic import case
We were also using tsx in tests, could you also replace them together? thanks! |
Some tests are failing |
I am still experimenting with things here and there. I am tracking CI at here: SukkaW#1 |
a3292ab
to
fefb08e
Compare
Looks good, is |
Yes. By default, SWC transforms all dynamic imports into |
I mean we don't have any case like that in bunchee so probably don't need it. I'll land this since everything looks good! Thanks! It sounds like a good feature to add into swc compilation. e.g. if the input is a cjs file and using dynamic import, SWC should preserve it. Are we having this in swc plugin? @SukkaW |
The PR replaces
tsx
with@swc-node/register
.bunchee
already prefers swc, it doesn't make sense to use esbuild as the build script loader. Let's switch it to swc.