除非使用browserify
和类似工具打包,否则是否有前端节点模块或全部都是服务器端?
Node.js modules are designed to be used with Node.js.
You might run Node.js as a server side environment. You might run it as a command line program. You might run it as an HTTP client in its own right.
Node.js does not run inside a browser. Node.js modules are not generally designed for use embedded in a webpage using <script>
elements.
It is possible to write a hybrid JavaScript file that can function both as a Node.js module and as a script in a webpage … but there isn't often a good reason to do so. (I've done it once: To write a client for a particular webservice that I wanted to use in a browser and in a Node.js program).
Browserify can convert some Node.js modules so they can run in a browser.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.