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: esm support #519

Closed
wants to merge 3 commits into from

Conversation

tinchoz49
Copy link
Contributor

@tinchoz49 tinchoz49 commented Jan 6, 2024

Not ready to merge: working on tests

This PR add the type keyword in the package.json and package every function with the package.json generated.

Allows you to use esbuild with format: 'esm' without having to change the outputFileExtension to mjs that it doesn't work well with serverless sdk: serverless/serverless#11308

Most of the time with this change + a banner to support require it's enough to have full support for esm.

esbuild.config.cjs

...
format: 'esm',
banner: {
    js: 'import { createRequire as topLevelCreateRequire } from \'module\';\n const require = topLevelCreateRequire(import.meta.url);',
  },
...

related: #483

@tinchoz49 tinchoz49 changed the title feat: add packageJSON type keyword feat: esm support Jan 7, 2024
@tinchoz49 tinchoz49 closed this Jan 9, 2024
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.

1 participant