简体   繁体   English

在 webpack 中包含外部库

[英]Include external library in webpack

What is the syntax for including libraries in the bundle?在包中包含库的语法是什么? What I found in "LIBRARY AND EXTERNALS" for the documentation is this:我在“LIBRARY AND EXTERNLS”中找到的文档是这样的:

  • depends on "jquery", but jquery should not be included in the bundle取决于“jquery”,但 jquery 不应包含在包中

What do I need to do if i want to do this instead:如果我想这样做,我需要做什么:

  • depends on "jquery", and jquery should be included in the bundle.取决于“jquery”,并且 jquery 应该包含在包中。

You can include it using Provideplugin您可以使用Provideplugin包含它

new webpack.ProvidePlugin({
    $: "jquery",
    jQuery: "jquery",
    "window.jQuery": "jquery"
}),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM