Skip to content

Conversation

@jet2jet
Copy link
Contributor

@jet2jet jet2jet commented Apr 3, 2021

This PR allows functions for resolving externals for both webpack 5 and prior to webpack 5 (issue: #1966 )

  • To handle configs for both webpack 5 and priors, this PR checks externals.length as webpack does.
  • In webpack 5.15, getResolve function is added to the object in the first argument, so this PR provides a very simple getResolve implementation (using the return value of getResolveSync).
  • In this PR async 'external functions' are still not supported (as async webpack config not supported; related: Add warning about async Webpack configs #1962)
    • synchronized-promise might be usable to resolve this, but I haven't tried yet. (If it is OK, I'll try to add using synchronized-promise into this PR or another.)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 69.827% when pulling b7bce61 on jet2jet:support-webpack5-externals-function into e871a9a on benmosher:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 69.827% when pulling b7bce61 on jet2jet:support-webpack5-externals-function into e871a9a on benmosher:master.

@coveralls
Copy link

coveralls commented Apr 3, 2021

Coverage Status

Coverage increased (+11.3%) to 82.45% when pulling da647d7 on jet2jet:support-webpack5-externals-function into 7974acc on benmosher:master.

@jet2jet jet2jet changed the title [Fix] add support for webpack 5 'externals function' [Fix] add support for webpack 5 'externals function' for eslint-import-resolver-webpack Apr 3, 2021
@ljharb ljharb force-pushed the support-webpack5-externals-function branch from b7bce61 to da647d7 Compare May 13, 2021 05:42
@ljharb ljharb changed the title [Fix] add support for webpack 5 'externals function' for eslint-import-resolver-webpack [resolvers/webpack] [New] add support for webpack 5 'externals function' May 13, 2021
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

nice work!

@ljharb ljharb merged commit da647d7 into import-js:master May 13, 2021
@jet2jet jet2jet deleted the support-webpack5-externals-function branch May 13, 2021 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants