[英]Browserify-shim - How to pass two global variables from one package into another
I want to pass two variables( $
and jQuery
) from jquery
package to persian-datepicker
. 我想将两个变量(
$
和jQuery
)从jquery
包传递给persian-datepicker
。 So I added $
and jQuery
as a dependency of persian-datepicker
. 因此,我添加了
$
和jQuery
作为persian-datepicker
的依赖项。 Is what I have done right? 我做的对吗?
But it seems that browserify-shim
just can't export one variable from a single package. 但是似乎
browserify-shim
不能从单个包中导出一个变量。
Any Idea? 任何想法?
My package.json
: 我的
package.json
:
... "browser": { "jquery": "./node_modules/jquery/dist/jquery.js", "persian-datepicker": "./node_modules/persian-datepicker/dist/js/persian-datepicker-0.4.5.js", }, "browserify-shim": { "./node_modules/persian-datepicker/dist/js/persian-datepicker-0.4.5.js": { "depends": [ "jquery:jQuery", "jquery:$" ] } }, "browserify": { "transform": [ "browserify-shim" ] }, ...
What you've done works perfectly well - you can export both $
and jQuery
via browserify-shim without a problem. 您所做的工作非常完美-您可以通过browserify-shim导出
$
和jQuery
,而不会出现问题。
If you're still trying to solve this what is the error you're getting? 如果您仍在尝试解决此问题,您将得到什么错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.