简体   繁体   English

如何将lodash 3.10.1从node_modules引用到html文件?

[英]How to reference lodash 3.10.1 from node_modules to html file?

I noticed that lodash@3.10.1 structure has changed to a modular format, how can I reference lodash from node_modules to my html page? 我注意到lodash@3.10.1的结构已更改为模块化格式,如何将lodash从node_modules引用到html页面? We are not allowed to use bower, so npm is the only option. 我们不允许使用Bower,因此npm是唯一的选择。

Thanks! 谢谢!

You probably want to use bower , the package manager for the "front end". 您可能要使用bower ,即“前端”的程序包管理器。 For example type in your CLI assuming you are project root directory: 例如,假设您是项目根目录,请键入CLI:

npm install -g bower
bower install lodash

In your index.html include lodash.js assuming it is your project root directory as well: index.html包括lodash.js并假设它也是项目的根目录:

<script src="bower_components/lodash/lodash.js"></script>

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

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