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

Improve loading of submodules #1939

Closed
wants to merge 8 commits into from

Conversation

DmitryScaletta
Copy link

1. Don't load submodules with not installed optional dependencies

Some packages may have optional dependencies.
If there was an error during loading a submodue, and it's a missing optional dependency error, just skip this submodule.

Closes #1937

2. Skip submodules if they have already been loaded as a part of main module

Example: some-module

package.json

{
  "exports": {
    ".": {
      // ...
      "default": "./index.js"
    },
    "./submodule": {
      // ...
      "default": "./submodule.js"
    }
  }
}

index.js

export * from './submodule';

submodule.js

export const submodule = () => {};

The main module exports all from the submodule.
And the submodule exports a function with the same name as a submodule name.
So when loading the submodule, lib already have a property submodule.

Closes #1938

  • tests and linter show no problems (npm t)
  • tests are added/updated for bug fixes and new features
  • code is properly formatted (npm run fmt)
  • description of changes is added in CHANGELOG.md
  • update .d.ts typings

@DmitryScaletta DmitryScaletta changed the base branch from master to publish November 12, 2023 14:13
@DmitryScaletta
Copy link
Author

GitHub is lagging. Can't change the base branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants