Using a npm module in a brunch app

江枫思渺然 提交于 2019-12-23 16:09:27

问题


I would like to use this node library: https://github.com/sudhirj/simply-deferred

I ran:

npm install simply-deferred

And added it to package.json under dependencies.

"simply-deferred": "*"

It installed successfully:

> require ("simply-deferred")
{ Deferred: [Function],
  when: [Function],
  installInto: [Function] }

But it is not added to vendor.js, and when I run require("simply-defered"), it says module not found (even when i manually added the js file to /vendors.

I am quite sure I am missing something obvious here, I am a npm/node n00b, so any help would be much appreciated!


回答1:


You cannot require NPM modules in brunch app. From the site:

Brunch is a HTML5 application assembler

npm is node.js package manager. Brunch is HTML5 app builder. Different stuff.



来源:https://stackoverflow.com/questions/17418027/using-a-npm-module-in-a-brunch-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!