Skip to content
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

feat: Support ESM and Typescript configs #30

Merged
merged 4 commits into from
Mar 9, 2025

Conversation

zirkelc
Copy link
Contributor

@zirkelc zirkelc commented Mar 7, 2025

Serverless currently doesn't support loading serverless.ts ESM files with export default { }. I submitted this PR serverless/serverless#11147 a long time ago, but they didn't go further with it because ESM in Node.js was not stable back then. It is stable now, but I think they wanted to support it only in v4.

Nevertheless, the original PR implemented the ESM+TS support in a hacky way with an intermediate script and a sub-process. Meanwhile I found a much better way using jiti and it is documented here: https://github.com/zirkelc/serverless-esm-ts

This PR implements it in the same way and replaces the old outdated ts-node for loading TypeScript configs.

@mnapoli
Copy link
Contributor

mnapoli commented Mar 7, 2025

That looks awesome!

The linting is failing though, are you able to look at it?

@zirkelc
Copy link
Contributor Author

zirkelc commented Mar 7, 2025

Should be fixed now

@zirkelc
Copy link
Contributor Author

zirkelc commented Mar 8, 2025

I will fix the new linting errors 😅

@mnapoli
Copy link
Contributor

mnapoli commented Mar 9, 2025

Year the rules on the repo are very strict 😅

@mnapoli
Copy link
Contributor

mnapoli commented Mar 9, 2025

Thank you!

@mnapoli mnapoli merged commit 6e1a0d8 into oss-serverless:main Mar 9, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants