简体   繁体   English

Node.JS嵌入式客户端模块

[英]Node.JS Embed Client Modules

I'm developing an node.js application and i want to "embed" the socket.io client module inside the javascript file. 我正在开发一个node.js应用程序,我想在JavaScript文件中“嵌入” socket.io客户端模块。 I'm sorry if my explaination is bad, and so i'll take an example. 如果我的解释不好,对不起,我举个例子。

My code looks like this: 我的代码如下所示:

 <script src="/socket.io/socket.io.js"></script> <script src="../js/ap.js"></script> 

I want to be like: 我想成为:

 <script src="../js/app.js"></script> 

and not only for socket.io, for all modules that i'll use. 不仅对于socket.io,对于我将使用的所有模块。

how to do this ? 这个怎么做 ? i've tried a lot of things but no solution. 我已经尝试了很多东西,但没有解决方案。

您应该研究一些用于为浏览器打包JavaScript代码的技术:bower,browserify和webpack。

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

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