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

fix(lib)!: remove format prefixes for cjs and esm #8107

Merged
merged 4 commits into from
May 12, 2022

Conversation

sachinraja
Copy link
Contributor

@sachinraja sachinraja commented May 10, 2022

Description

Follow up to #6827. Remove the format extensions for cjs and esm. Example: my-lib.es.js -> my-lib.js.

This is a breaking change.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

playground/vue-lib/src-consumer/index.ts Show resolved Hide resolved
@@ -592,6 +592,10 @@ export function resolveLibFilename(
extension = format === 'es' ? 'mjs' : 'js'
}

if (format === 'cjs' || format === 'es') {
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but should we allow es(deprecate this) / esm (new value)

Copy link
Member

Choose a reason for hiding this comment

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

Do you have some links to support esm over es? Rollup is using es for their format config, I think alignment with them is good here.

Copy link
Member

Choose a reason for hiding this comment

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

Oh interesting, I thought this was coming from cjs/esm wordings that also e.g. TypeScript is using

@patak-dev patak-dev changed the title fix(lib): remove format prefixes for cjs and esm fix(lib)!: remove format prefixes for cjs and esm May 12, 2022
@patak-dev patak-dev merged commit ad8c3b1 into vitejs:main May 12, 2022
@patak-dev patak-dev added p2-nice-to-have Not breaking anything but nice to have (priority) breaking change labels May 12, 2022
@sachinraja sachinraja deleted the fix-format-prefixes branch May 12, 2022 13:43
@antfu antfu added this to the 3.0 milestone May 13, 2022
@sachinraja sachinraja mentioned this pull request May 22, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change feat: library mode p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants