【发布时间】:2017-08-29 16:22:19
【问题描述】:
我根本不是 Node 方面的专家,但我正在学习!我最近遇到了一个我想包含在项目“响应式背景”https://www.npmjs.com/package/responsive-backgrounds 中的模块。
所有都安装了npm install --save-dev responsive-backgrounds 并且看起来很好(即我可以在我的缩小和丑化的分发 JS 中看到 ResponsiveBackgrounds)。在我的主 JS 文件中,我有:
require("responsive-backgrounds");
options = {
lazy: true,
transition: 0.5
};
new ResponsiveBackground("#featuredimage", options);
但是,当我运行浏览器化和丑化的 JS 时,我得到了 Uncaught ReferenceError: ResponsiveBackground is not defined。我错过了一些重要的东西吗?我敢肯定还有其他库可以完成相同的工作甚至更好,但这更多是为了了解如何正确包含节点模块。
【问题讨论】:
标签: node.js npm browserify