Skip to content

Conversation

@enisdenjo
Copy link
Member

@enisdenjo enisdenjo commented Jan 20, 2025

Important

All package.jsons are now required to have "type": "module". However, we can remove this requirement and accept CJS projects too - but we never use CJS in our projects.

"main" package.json field matches the location of "type" output

The "type" field defines the module format that Node.js uses for all .js files that have that package.json file as their nearest parent.

Files ending with .js are loaded as ES modules when the nearest parent package.json file contains a top-level field "type" with a value of "module".

If the nearest parent package.json lacks a "type" field, or contains "type": "commonjs", .js files are treated as CommonJS. If the volume root is reached and no package.json is found, .js files are treated as CommonJS.

Node documentation

Drop "module" package.json field

The field was just a proposal and Node never officially supported it. Node instead uses the "exports" field.

Drop "typescript" package.json field

I don't know why this existed in the first place. If someone explains why we had it and the argument is still valid, we can put it back.

@changeset-bot
Copy link

changeset-bot bot commented Jan 20, 2025

🦋 Changeset detected

Latest commit: fe56019

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
bob-the-bundler Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
bob-the-bundler 8.0.0-alpha-20250120171041-fe56019f76d291ad2a0c0cb919605cef8e617491 npm ↗︎ unpkg ↗︎

@enisdenjo enisdenjo merged commit f6be910 into master Jan 21, 2025
6 checks passed
@enisdenjo enisdenjo deleted the packagejson branch January 21, 2025 16:28
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