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: export commonjs and esm from package #59

Merged
merged 3 commits into from
Oct 11, 2023

Conversation

lukasholzer
Copy link
Contributor

🎉 Thanks for sending this pull request! 🎉

To support our old CommonJS packages like the next-runtime export both commonjs and ESM.
Full discussion is here: https://netlify.slack.com/archives/C05DNT7CLFK/p1696930990204579

cc @ascorbic @orinokai @pieh

@lukasholzer lukasholzer requested a review from a team as a code owner October 11, 2023 14:03
@netlify
Copy link

netlify bot commented Oct 11, 2023

Deploy Preview for blobs-js ready!

Name Link
🔨 Latest commit 4dc45d4
🔍 Latest deploy log https://app.netlify.com/sites/blobs-js/deploys/6526ac903f786900084a9ccc
😎 Deploy Preview https://deploy-preview-59--blobs-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Oct 11, 2023
Copy link
Contributor

@Skn0tt Skn0tt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach looks good. These ESM migrations typically break something, so i'd encourage you to publish this as a prerelease first (or yolo it, as you prefer).

Just calling out that this change starts bundling in all dependencies. Shouldn't be a problem as long as the dependencies aren't big, but this will probably break for more involved dependencies, like when there's native code. (but I think esbuild was already doing that before? plus this needs to work in edge functions as well.)

@lukasholzer
Copy link
Contributor Author

lukasholzer commented Oct 11, 2023

On the bundling part you are completely right. Next goal is to get rid of p-map as it's an esm only dependency then we would have 0 deps which is good IMHO
I did already two pre releases: and on publint all looks good

https://publint.dev/@netlify/[email protected]

CleanShot 2023-10-11 at 16 17 59

and types as well: https://arethetypeswrong.github.io/?p=%40netlify%2Fblobs%402.1.0-rc.2

CleanShot 2023-10-11 at 16 18 11

@lukasholzer lukasholzer merged commit 38b9c81 into main Oct 11, 2023
9 checks passed
import { rm } from 'node:fs/promises'
import { argv } from 'process'

// eslint-disable-next-line import/no-extraneous-dependencies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this an extraneous dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it's a dev dependency 🤷 the lint rule is crazy.

Eslint does not know that we don't need it as dependency:

'tsup' should be listed in the project's dependencies. Run 'npm i -S tsup' to add iteslintimport/no-extraneous-dependencies

@eduardoboucas eduardoboucas deleted the feat/provide-cjs-package branch October 24, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants