Skip to content

Conversation

unicornware
Copy link
Member

Description

  • Set package version to 5.0.0-dev.0
  • Added CHANGELOG entry for 5.0.0-dev.0

Tests

Test Suites: 1 passed, 1 total
Tests:       77 passed, 77 total
Snapshots:   0 total
Time:        43.612 s
Ran all test suites.

Additional context

  • How to Create a Hybrid NPM Module for ESM and CommonJS:

    The problem with the package.json type property

    To resolve the problem of whether a file with a .js extension is an ES module or CommonJS module, Node invented the package.json type property and conventions. If you set the type to "module", then all files in that directory and sub-directories are considered to be ESM until either another package.json or node_modules directory is encountered. If you set the type to "commonjs", all files are assumed to be CommonJS.

    These defaults can be overridden by explicitly naming a file with a .cjs or .mjs extension.

    package.json:

    {
        "version": "1.2.3",
        "type": "module"
    }

    This works fairly well but your package is either a "module" or "commonjs" by default. The problem is what happens when you need a package to be a hybrid and export both ESM and CommonJS formats? Unfortunately there is no way to have a conditional type that can be "module" when consumed as ESM and "commonjs" when consumed by CommonJS.

    Node does provide a conditional exports property that defines the package's export entry points. However, this does not redefine the package type and the type and exports properties do not combine well.

  • Announcing a new --experimental-modules (Medium):

    .cjs extension

    Just as the .mjs file extension explicitly signifies that a file should be treated as an ES module, the new .cjs file
    extension explicitly signifies that a file should be treated as CommonJS. (CommonJS is the other module system that
    Node.js supports, with require and module.exports.) The .cjs extension provides a way to save CommonJS files in a
    project where both .mjs and .js files are treated as ES modules.

  • Hybrid ESM/CJS modules in TypeScript

  • convert-extension

Linked issues

None

Submission checklist

  • pr title prefixed with PR: (e.g: PR: User authentication)
  • pr title describes functionality (not vague title like Update index.md)
  • pr targets branch next
  • project was run locally to verify that there are no errors
  • documentation added or updated

@unicornware unicornware added scope:deploy-release type:docs documentation improvements labels Oct 7, 2021
@unicornware unicornware self-assigned this Oct 7, 2021
Copy link
Contributor

@flexdevelopment flexdevelopment left a comment

Choose a reason for hiding this comment

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

lgtm 👍🏾

@unicornware unicornware merged commit 195bf7e into next Oct 7, 2021
unicornware added a commit that referenced this pull request Oct 7, 2021
* chore(release): set package version
* release: @flex-development/exceptions@5.0.0-dev.0
@unicornware unicornware deleted the release/exceptions@5.0.0-dev.0 branch October 7, 2021 14:48
@github-actions
Copy link

github-actions bot commented Nov 7, 2021

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or features. Be sure to reference this issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2021
@unicornware unicornware added scope:release package release and removed type:docs documentation improvements labels Aug 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope:release package release
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants