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

Add ESModules import support #325

Merged
merged 1 commit into from
Jun 5, 2020
Merged

Add ESModules import support #325

merged 1 commit into from
Jun 5, 2020

Conversation

lundibundi
Copy link
Member

  • code is properly formatted (npm run fmt)
  • documentation is updated (npm run doc to regenerate documentation based on comments)
  • description of changes is added under the Unreleased header in CHANGELOG.md

Also, when 'Conditional exports' are no longer experimental the package.json could be changed to use

  "exports": {
    "require": "./common.js",
    "import": "./common.mjs"
  },

to automativally resolve '@metarhia/common' depending on require or import usage. (without the need to use @metahia/common/module)

/cc @nechaido @tshemsedinov

@lundibundi lundibundi requested a review from belochub March 1, 2020 11:36
@lundibundi lundibundi self-assigned this Mar 1, 2020
@tshemsedinov
Copy link
Member

I don't like esmodules but let it be 😄

Copy link
Member

@nechaido nechaido left a comment

Choose a reason for hiding this comment

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

RSLGTM

common.mjs Show resolved Hide resolved
@lundibundi
Copy link
Member Author

ping @belochub.

@lundibundi
Copy link
Member Author

ping @belochub

Copy link
Member

@belochub belochub left a comment

Choose a reason for hiding this comment

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

LGTM with a small suggestion.

tools/esmodules-export-gen.js Show resolved Hide resolved
@belochub belochub merged commit 94df329 into master Jun 5, 2020
@belochub
Copy link
Member

belochub commented Jun 5, 2020

Landed in 94df329.

@belochub belochub deleted the support-modules branch June 5, 2020 15:31
@belochub
Copy link
Member

As it turns out, this PR has introduced a regression by breaking support for importing submodules (e.g. require('@metarhia/common/lib/id')) in latest Node.js versions. As such, unless another commit fixing this will be introduced before the next minor release, this feature will only be made available in the next major release.

@belochub belochub added the semver-major incompatible API changes label Jun 10, 2020
lundibundi added a commit that referenced this pull request Jun 10, 2020
@lundibundi
Copy link
Member Author

Should be fixed with #336.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility semver-major incompatible API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants