为什么 Node.js 与浏览器不兼容?
Why is Node.js not compatible with browsers?
我在 Medium 上阅读了一篇关于 Deno vs Node 的文章,我看到了这个部分:
The main problem here is that the module system isn’t compatible with
browsers. That is the reason for storing dependencies in node_modules
and having a package.json.
Node.js 与浏览器不兼容是什么意思?有人可以澄清并提供额外的 details/resources 吗?
文中的意思是说 Deno 使用了比 Node 更标准的模块系统(ES 模块)。
这使得编写可用于 运行 Deno 应用程序以及 运行 浏览器应用程序的模块变得更加容易,因为现代浏览器也支持 ES 模块。
我在 Medium 上阅读了一篇关于 Deno vs Node 的文章,我看到了这个部分:
The main problem here is that the module system isn’t compatible with browsers. That is the reason for storing dependencies in node_modules and having a package.json.
Node.js 与浏览器不兼容是什么意思?有人可以澄清并提供额外的 details/resources 吗?
文中的意思是说 Deno 使用了比 Node 更标准的模块系统(ES 模块)。
这使得编写可用于 运行 Deno 应用程序以及 运行 浏览器应用程序的模块变得更加容易,因为现代浏览器也支持 ES 模块。