【发布时间】:2020-05-27 19:49:18
【问题描述】:
我尝试使用命令npm i -g browserify 全局安装 npm browserify。然后我在终端 browserify app.js -o bundle.js 命令中写入,该命令创建了 bundle.js 文件,然后我转到我的 index.html 并将我的脚本更改为 <script defer src="bundle.js"/> 。我去检查确实错误 Uncaught referenceError: require is not defined 消失了,但我有这个新错误:
bundle.js:41149 Uncaught TypeError: Cannot read property 'prototype' of undefined
at Object.<anonymous> (bundle.js:41149)
at Object.236../utils (bundle.js:42251)
at o (bundle.js:1)
at bundle.js:1
at Object.232../application (bundle.js:40389)
at o (bundle.js:1)
at bundle.js:1
at Object.230../lib/express (bundle.js:39717)
at o (bundle.js:1)
at bundle.js:1
(anonymous) @ bundle.js:41149
236../utils @ bundle.js:42251
o @ bundle.js:1
(anonymous) @ bundle.js:1
232../application @ bundle.js:40389
o @ bundle.js:1
(anonymous) @ bundle.js:1
230../lib/express @ bundle.js:39717
o @ bundle.js:1
(anonymous) @ bundle.js:1
(anonymous) @ bundle.js:36124
206._process @ bundle.js:36133
o @ bundle.js:1
r @ bundle.js:1
(anonymous) @ bundle.js:1
【问题讨论】:
-
你也可以发布你的代码吗?
-
@PawanKumar 我发布了答案
标签: javascript html node.js browserify