简体   繁体   English

将google-api-nodejs-client与browserify捆绑在一起不起作用

[英]Bundling google-api-nodejs-client with browserify doesn't work

I'm trying to build a client-side application with google-api-nodejs-client using browserify. 我正在尝试使用browserify使用google-api-nodejs-client构建客户端应用程序。 Looks like inside it is trying to read some mime-type info using fs module and fails to do it in browser. 看起来它内部试图使用fs模块读取某些mime类型的信息,但在浏览器中无法执行。

    // Load additional types from node.js community
    mime.load(path.join(__dirname, 'types/node.types'));

    // Default type
    mime.default_type = mime.lookup('bin');

Did anybody use this API for client side development? 是否有人使用此API进行客户端开发?

This question has been addressed and closed here on GitHub . 这个问题已经在GitHub上解决并关闭。

fs is not available from the browser, unfortunately. 不幸的是,浏览器不提供fs。 This library is specifically designed and implemented for server-side development and is unsupported for client-side development. 该库是专门为服务器端开发设计和实现的,客户端开发不支持该库。

Check out https://developers.google.com/api-client-library/javascript/ which is designed for JavaScript client-application developers. 查看https://developers.google.com/api-client-library/javascript/ ,它是为JavaScript客户端应用程序开发人员设计的。

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

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