如何调查“无法找到模块X”来自browserified捆绑? [英] How to investigate "Cannot find module X" coming from browserified bundles?

查看:216
本文介绍了如何调查“无法找到模块X”来自browserified捆绑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

绝望模式:尝试了很多不同的配置,都失败了。我在这里有一个名为videomail-client.js的browserified + babelified包:

https://github.com/binarykitchen/videomail-client/tree/develop/dist



现在,当我 require()时,这个包的主要条目指向这个文件。该包来自另一个项目并对其进行浏览,然后使用browserify从吞噬任务中看到此错误:

  [16:26 :32]错误:在/ home / michael-heuberger / code /中找不到'/home/michael-heuberger/code/videomail.io/node_modules/videomail-client/dist'
模块'./keys' videomail.io/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21
(load /home/michael-heuberger/code/videomail.io/node_modules/browser-resolve/node_modules /resolve/lib/async.js:69:43)onex的
(/ home / michael-heuberger / code / vi deomail.io/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
位于/home/michael-heuberger/code/videomail.io/node_modules/browser-resolve/node_modules/解决/ lib / async.js:22:47在FSReqWrap.oncomplete(fs.js:152:21)



mm,听起来很复杂?让我重述一下。包视频邮件客户端浏览。另一个项目videomail.io需要它,并再次与其他软件包一起重新浏览。

另一方面,当我使用videomail-client.js运行独立的示例时,它可以正常工作。



我认为问题在于browserify无法解析 ./ keys 文件。但它应该包含在browserified的videomail-client.js包中并从那里解析。我如何告诉browserify以正确的方式解决问题?



建议欢迎我如何调查和解决这个问题。感谢!!

解决方案

解决方案有两个步骤:使用browserify的独立选项和 gulp-dereire 包。它现在有效。


Desperate mode: Tried many different configs and all failed. I have a browserified + babelified bundle called videomail-client.js here:

https://github.com/binarykitchen/videomail-client/tree/develop/dist

The package.json's main entry of that package is pointing to this file.

Now, when I require() that package from another project within and browserify it, then I see this error from the gulp task using browserify:

[16:26:32] Error: Cannot find module './keys' from '/home/michael-heuberger/code/videomail.io/node_modules/videomail-client/dist'
    at /home/michael-heuberger/code/videomail.io/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21
    at load (/home/michael-heuberger/code/videomail.io/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
    at onex (/home/michael-heuberger/code/videomail.io/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
    at /home/michael-heuberger/code/videomail.io/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:152:21)

Hmnmm, sounds complicated? Let me rephrase. Package videomail-client is browserified. Another project, videomail.io, is requiring it and browserifying all together over again with other packages. That's there it fails.

On a side note, when I run standalone examples using videomail-client.js, it works fine.

I think the problem is that browserify can't resolve the ./keys file. But it should be included in the browserified videomail-client.js package and resolved from there. How can I tell browserify to resolve it the correct way?

Suggestions welcome how I can investigate and fix this best. Thanks!!

解决方案

The solution has two steps: use browserify's standalone option and the gulp-derequire package. It works now.

这篇关于如何调查“无法找到模块X”来自browserified捆绑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆