【发布时间】:2017-07-18 02:18:22
【问题描述】:
我需要将带有速度插件的 scrollMagic 添加到我的 npm 库中。
package.json
{
"name": "library",
"version": "1.0.10",
"description": "blabla",
"main": "index.js",
"dependencies": {
"shortid": "2.x",
"jquery": "2.x",
"scrollmagic": "2.x"
}
}
有没有办法做到这一点?
仅添加 ScrollMagic 不包含插件。
如果需要更多信息,请告诉我。
编辑:
如果我像这样添加插件:require('scrollmagic/uncompressed/plugins/animation.velocity.js')
我收到这些错误。
ERROR in ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.velocity.js
Module not found: Error: Cannot resolve module 'ScrollMagic' in /home/av/local.dev/testest/node_modules/scrollmagic/scrollmagic/uncompressed/plugins
@ ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.velocity.js 31:2-46
ERROR in ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.velocity.js
Module not found: Error: Cannot resolve module 'velocity' in /home/av/local.dev/testest/node_modules/scrollmagic/scrollmagic/uncompressed/plugins
@ ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.velocity.js 31:2-46
【问题讨论】:
-
It's in there,你只需要使用它。
require('scrollmagic/uncompressed/plugins.animation.velocity.js') -
我把这个放在哪里?我是我的 entry.js?
-
可能。我不知道您的应用程序的结构如何。只需在包含 ScrollMagic 之后再包含它。
-
我编辑了帖子并添加了编译插件时抛出webpack的错误。
-
遇到同样的问题。使用browsify-rails。 webpack 没有修复
标签: javascript node.js package.json