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(pnp): handle dynamic imports in CJS files #3170

Merged
merged 1 commit into from Jul 26, 2021

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