webpack 编译console报错必须使用window.console

问题遇到的现象和发生背景

react应用使用eject之后编译报错

用代码块功能插入代码,请勿粘贴截图

console不行必须使用window.console

运行结果及报错内容

ERROR in ./src/pages/home/map3d/cesiumReact/datasource/GeoJson.jsx 29:6-13
Module not found: Error: You attempted to import /Users/wen/gisspring-project/smart-city-management/node_modules/console-browserify/index.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project's node_modules/.

ERROR in ./src/pages/home/map3d/cesiumReact/datasource/GeoJson.jsx
Cannot read property 'module' of undefined

我的解答思路和尝试过的方法

没有找到相关的问题

我想要达到的结果

直接使用console

GeoJson.jsx 29 行 这个组件截个图看看 。可能是 this指向问题(不过 console是全局属性不应该出现这个问题)