简体   繁体   English

为什么控制台登录库在导入到不同的 React 组件后不起作用?

[英]Why console log on library doesn't work, when it has been imported to a different react component?

I have a library 'some-library' where i have written a console.log("message from some library") statement in 'some-component.js'.我有一个库'some-library',我在'some-component.js'中写了一个console.log(“来自某个库的消息”)语句。 I have used uglifyjs in this library with default settings.我在这个库中使用了默认设置的 uglifyjs。 When I import 'some-component' from 'some-library' i do not see 'message from some library'.当我从“some-library”导入“some-component”时,我没有看到“来自某个库的消息”。 Request you to please help me in this?请你帮我解决这个问题?

I have tried with npm link, it doesn't work.我试过使用 npm 链接,它不起作用。 Manually copy pasted the libraries(pretty similar to link) in the calling component.在调用组件中手动复制粘贴库(非常类似于链接)。 But doesn't work.但不起作用。 Whereas if i put the source code of the library in the calling component.而如果我将库的源代码放在调用组件中。 I see the message.我看到消息了。

Sorry, got this sorted.抱歉,已经解决了。 I had used sumologic library and had replaced console log instead of augmenting it.我使用过 sumologic 库并替换了控制台日志而不是增加它。 The issue is now sorted.现在问题已解决。

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

相关问题 为什么我的 React 组件不会在 foreach 中呈现我想要的内容,但会使用 console.log 记录数组? - Why doesn't my React component renders what I want in a foreach, but will console.log the array? 为什么 react 不显示从外部库导入的 svg? - Why doesn't react display an svg imported from an external library? 装入组件时不加载导入的脚本-React JS - Imported Script doesn't load when a component is mounted - React JS 为什么 conv.add 在使用 API 时 console.log 不起作用 - Why doesn't conv.add work when console.log does when using an API 将console.log作为参数传递给forEach时为什么不起作用? - Why doesn't console.log work when passed as a parameter to forEach? 为什么“console.log”在“return”命令后不起作用? - Why "console.log" doesn't work after a "return" command? 为什么“console.log()”在这个网站上不起作用? - Why doesn't "console.log()" work on this website? 为什么console.log不能作为参数? - Why console.log doesn't work as an argument? 为什么jQuery在本地导入时不起作用 - Why doesn't jQuery work when imported locally IntelliSense无法与我自己的React组件库一起使用 - IntelliSense doesn't work with my own React component library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM