Skip to content

fix(pnp): handle dynamic imports in CJS files#3170

Merged
arcanis merged 1 commit intomasterfrom
merceyz/fix/pnp-dynamic-import
Jul 26, 2021
Merged

fix(pnp): handle dynamic imports in CJS files#3170
arcanis merged 1 commit intomasterfrom
merceyz/fix/pnp-dynamic-import

Conversation

@merceyz
Copy link
Member

@merceyz merceyz commented Jul 24, 2021

What's the problem this PR addresses?

Dynamic imports in CJS files that import other CJS files doesn't load the module and just returns an empty object.

Note that dynamic imports in CJS files only works for things Node can find without the PnP runtime.

Extracted from #2161
Fixes #3163

How did you fix it?

Load the module if it hasn't been loaded but exists in the cache.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis arcanis merged commit acb824d into master Jul 26, 2021
@arcanis arcanis deleted the merceyz/fix/pnp-dynamic-import branch July 26, 2021 09:33
@merceyz merceyz mentioned this pull request Sep 1, 2021
3 tasks
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.

[Bug?]: Issue with pnp not recognizing node 12.22+ dynamic import used by Mocha v9

2 participants