如何进行console.log debugging with.js对依赖项包进行调试
运行下一个dev
,我可以在以下路径上在.js文件上将断点(例如chrome)放在浏览器中,并且点击点(此文件是一个软件包的一部分)我正在处理的项目的依赖性):
webpack-internal://
.
node_modules
ra-core/esm
dataProvider
useGetMany.js
但是,我想在该文件中进行一些台。碰巧的是,文件最初是一个打字稿文件 - 但我不介意我是编辑生成的.js还是原始的.ts。
问题是我的console.log
s似乎没有生效。编辑了node_modules中的每份usegany.js/useGetMany.ts的副本,重新启动了Dev服务器,并完成了一个硬盘,我仍然看不到我的编辑在.js源代码中显示我看到的.js源代码,我看到的是通过浏览
> webpack-internal://
在浏览器中(我在Chrome和Firefox中都看到了这一点)。我也不会看到我的console.log
输出。
这些是我编辑的文件:
node_modules/ra-core/esm/dataProvider/useGetMany.js
node_modules/ra-core/lib/dataProvider/useGetMany.js
node_modules/ra-core/src/dataProvider/useGetMany.ts
我在做什么,我该怎么做console.log
在这里调试?
Running next dev
, I can put a breakpoint in a browser (for example chrome) on a .js file at the following path, and the breakpoint is hit (this file is part of a package that is a dependency of the project I'm working on):
webpack-internal://
.
node_modules
ra-core/esm
dataProvider
useGetMany.js
However, I'd like instead to do some console.log debugging in that file. As it happens that file is originally a TypeScript file - but I don't mind whether I'm editing generated .js or the original .ts
The problem is that my console.log
s don't seem to take effect. Having edited every copy of useGetMany.js/useGetMany.ts in node_modules, restarted the dev server, and done a hard-refresh, I still don't see my edit show up in the .js source code I see browsing through webpack-internal://
in the browser (I see this both in chrome and firefox). Nor do I see my console.log
output.
These are the files I edited:
node_modules/ra-core/esm/dataProvider/useGetMany.js
node_modules/ra-core/lib/dataProvider/useGetMany.js
node_modules/ra-core/src/dataProvider/useGetMany.ts
What am I doing wrong and how can I do console.log
debugging here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下一个开发服务器默认在服务器端呈现文件,因此console.log应该在启动开发服务器的终端上输出。
如果还是没有输出日志,可以尝试先删除
.next
缓存文件夹。Next development server renders files on server side by default, so
console.log
should output on the terminal, where the development server was started.If it is still not outputting the log, you can try to remove the
.next
cache folder first.