How does the packaged npm component module extract the common library so that other installers of this component use their own common library?

now it"s time to package a library, which uses jquery

.

the goal is that
jquery is not packaged into a. After other projects install library a, install jquery (or have their own) when installing dependencies, and run-time a can use the project"s jquery library

.
Mar.04,2021

write it in the externals attribute array in the webpack configuration


official English document
if English is not good, You can refer to the following two articles:
webpack's in-depth understanding of externals
webpack externals

Menu