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

refactor: Simplify package manifest config #1

Merged
merged 1 commit into from
Jul 6, 2023
Merged

refactor: Simplify package manifest config #1

merged 1 commit into from
Jul 6, 2023

Conversation

rschristian
Copy link
Contributor

No description provided.

@@ -19,23 +19,18 @@
"license": "MIT",
"files": ["dist", "src"],
"source": "src/index.ts",
"module": "./dist/index.module.js",
Copy link
Contributor Author

@rschristian rschristian Jul 6, 2023

Choose a reason for hiding this comment

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

package.json#module is only used by bundlers, very unlikely anyone will be using this and if they do, package.json#exports is higher priority anyways in every bundler for the past 3+ years.

Can add it if you want, but will probably never see use.

Comment on lines -27 to -35
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.module.js"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.cjs"
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless you're shipping separate types for CJS and ESM (which Microbundle won't generate, though I don't think your interface needs it anyhow), there's no reason to nest like this.

},
"scripts": {
"build": "microbundle --target node --sourcemap false --format cjs,esm"
"build": "microbundle --target node --sourcemap false --format cjs,modern"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

esm is ES5, switching to modern saves a tiny bit of build time (fewer transforms) and is completely safe behind package.json#exports. If you do want to use package.json#module for some reason, it could make sense to switch this back to esm in the unlikelihood this plugin is used in an env that existed between 2015-2017.

@lukewarlow lukewarlow merged commit 1ac1cb9 into lukewarlow:master Jul 6, 2023
@lukewarlow
Copy link
Owner

Thank you for your contribution!

@rschristian rschristian deleted the chore/alter-pkg-config branch July 8, 2023 04:33
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