Webpack 4:日志记录

4
在使用webpack构建代码时,我遇到了以下类似的日志信息。
[../node_modules/lodash/lodash.js] 504 KiB {main} [built]
    harmony import specifier lodash [./client.js] 82:13-14
    harmony import specifier lodash [./selectors/buyInsuranceSelectors.js] 49:42-43
    harmony import specifier lodash [./client.js] 84:7-8
    harmony import specifier lodash [./client.js] 86:6-7
    harmony import specifier lodash [./client.js] 88:6-7
    harmony import specifier lodash [./client.js] 97:27-28
    harmony import specifier lodash [./client.js] 99:16-17
    harmony import specifier lodash [./client.js] 129:19-20
    harmony import specifier lodash [./client.js] 164:29-30
    harmony side effect evaluation lodash [./store/configureStore.js] 5:0-23
    harmony import specifier lodash [./store/configureStore.js] 12:23-24
    harmony import specifier lodash [./store/configureStore.js] 51:14-15
    harmony side effect evaluation lodash [./selectors/userInfoSelector.js] 8:0-23
    harmony import specifier lodash [./selectors/userInfoSelector.js] 10:25-26
    harmony import specifier lodash [./selectors/userInfoSelector.js] 12:9-10
    harmony side effect evaluation lodash [./services/GTMUtil.js] 8:0-23
    harmony import specifier lodash [./services/GTMUtil.js] 363:27-28
    harmony import specifier lodash [./services/GTMUtil.js] 440:15-16
    harmony import specifier lodash [./services/GTMUtil.js] 452:15-16
    harmony import specifier lodash [./services/GTMUtil.js] 460:15-16

有没有办法删除这些日志,例如“harmony side effect evaluation lodash [./services/GTMUtil.js] 8:0-23”,因为它们太多了,终端输出变得太拥挤了?

1个回答

6
为了删除这些日志,您可以在webpack配置中添加一个“stats”对象。在该对象中,您需要将“modules”属性设置为false。
因此,在您的webpack.config.js文件中,它可能是这样的:
stats: { 
  modules: false
}

一旦您这样做,这些将被删除。如果您想了解更多信息,webpack在此处涵盖了您可以切换的所有统计信息 https://webpack.js.org/configuration/stats/


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接