webpack chart检测出来内容为0

来源:6-7 基于webpack的应用大小监测与分析【webpack性能分析的法宝】

jy_li

2021-10-22

老师您好,图片描述打包后生成的文件是这样的,是什么原因呢,和webpack版本有关吗,我项目的webpack是3.0版本的,这个在线工具是只能4.0以上用吗

写回答

2回答

jy_li

提问者

2021-10-22

{"hash":"90a3ff1d7d01ac8fd769","version":"5.59.0","time":146,"builtAt":1634723588629,"publicPath":"auto","outputPath":"D:\\work\\swj\\web\\swj\\dist","assetsByChunkName":{"main":["main.js"]},"assets":[{"type":"asset","name":"main.js","size":0,"emitted":false,"comparedForEmit":false,"cached":true,"info":{"javascriptModule":false,"minimized":true},"chunkNames":["main"],"chunkIdHints":[],"auxiliaryChunkNames":[],"auxiliaryChunkIdHints":[],"related":{},"chunks":[179],"auxiliaryChunks":[],"isOverSizeLimit":false}],"chunks":[{"rendered":true,"initial":true,"entry":true,"recorded":false,"size":0,"sizes":{},"names":["main"],"idHints":[],"runtime":["main"],"files":["main.js"],"auxiliaryFiles":[],"hash":"cb7f0f08eff32f377d7b","childrenByOrder":{},"id":179,"siblings":[],"parents":[],"children":[],"modules":[],"origins":[{"module":"","moduleIdentifier":"","moduleName":"","loc":"main","request":"./src"}]}],"modules":[],"entrypoints":{"main":{"name":"main","chunks":[179],"assets":[{"name":"main.js"}],"filteredAssets":0,"assetsSize":null,"auxiliaryAssets":[],"filteredAuxiliaryAssets":0,"auxiliaryAssetsSize":0,"children":{},"childAssets":{},"isOverSizeLimit":false}},"namedChunkGroups":{"main":{"name":"main","chunks":[179],"assets":[{"name":"main.js"}],"filteredAssets":0,"assetsSize":null,"auxiliaryAssets":[],"filteredAuxiliaryAssets":0,"auxiliaryAssetsSize":0,"children":{},"childAssets":{},"isOverSizeLimit":false}},"errors":[{"loc":"main","message":"Module not found: Error: Can't resolve './src' in 'D:\\work\\swj\\web\\swj'","details":"resolve './src' in 'D:\\work\\swj\\web\\swj'\n  using description file: D:\\work\\swj\\web\\swj\\package.json (relative path: .)\n    Field 'browser' doesn't contain a valid alias configuration\n    using description file: D:\\work\\swj\\web\\swj\\package.json (relative path: ./src)\n      no extension\n        Field 'browser' doesn't contain a valid alias configuration\n        D:\\work\\swj\\web\\swj\\src is not a file\n      .js\n        Field 'browser' doesn't contain a valid alias configuration\n        D:\\work\\swj\\web\\swj\\src.js doesn't exist\n      .json\n        Field 'browser' doesn't contain a valid alias configuration\n        D:\\work\\swj\\web\\swj\\src.json doesn't exist\n      .wasm\n        Field 'browser' doesn't contain a valid alias configuration\n        D:\\work\\swj\\web\\swj\\src.wasm doesn't exist\n      as directory\n        existing directory D:\\work\\swj\\web\\swj\\src\n          using description file: D:\\work\\swj\\web\\swj\\package.json (relative path: ./src)\n            using path: D:\\work\\swj\\web\\swj\\src\\index\n              using description file: D:\\work\\swj\\web\\swj\\package.json (relative path: ./src/index)\n                no extension\n                  Field 'browser' doesn't contain a valid alias configuration\n                  D:\\work\\swj\\web\\swj\\src\\index doesn't exist\n                .js\n                  Field 'browser' doesn't contain a valid alias configuration\n                  D:\\work\\swj\\web\\swj\\src\\index.js doesn't exist\n                .json\n                  Field 'browser' doesn't contain a valid alias configuration\n                  D:\\work\\swj\\web\\swj\\src\\index.json doesn't exist\n                .wasm\n                  Field 'browser' doesn't contain a valid alias configuration\n                  D:\\work\\swj\\web\\swj\\src\\index.wasm doesn't exist","stack":"ModuleNotFoundError: Module not found: Error: Can't resolve './src' in 'D:\\work\\swj\\web\\swj'\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\Compilation.js:2004:28\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\NormalModuleFactory.js:795:13\n    at eval (eval at create (C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\node_modules\\tapable\\lib\\HookCodeFactory.js:33:10), <anonymous>:10:1)\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\NormalModuleFactory.js:275:22\n    at eval (eval at create (C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\node_modules\\tapable\\lib\\HookCodeFactory.js:33:10), <anonymous>:9:1)\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\NormalModuleFactory.js:431:22\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\NormalModuleFactory.js:124:11\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\NormalModuleFactory.js:667:25\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\NormalModuleFactory.js:852:8\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\NormalModuleFactory.js:972:5"}],"errorsCount":1,"warnings":[{"message":"configuration\nThe 'mode' option has not been set, webpack will fallback to 'production' for this value.\nSet 'mode' option to 'development' or 'production' to enable defaults for each environment.\nYou can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/","stack":"NoModeWarning: configuration\nThe 'mode' option has not been set, webpack will fallback to 'production' for this value.\nSet 'mode' option to 'development' or 'production' to enable defaults for each environment.\nYou can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\WarnNoModeSetPlugin.js:20:30\n    at Hook.eval [as call] (eval at create (C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\node_modules\\tapable\\lib\\HookCodeFactory.js:19:10), <anonymous>:21:1)\n    at Hook.CALL_DELEGATE [as _call] (C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\node_modules\\tapable\\lib\\Hook.js:14:14)\n    at Compiler.newCompilation (C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\Compiler.js:1052:30)\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\Compiler.js:1097:29\n    at Hook.eval [as callAsync] (eval at create (C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\node_modules\\tapable\\lib\\HookCodeFactory.js:33:10), <anonymous>:6:1)\n    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\node_modules\\tapable\\lib\\Hook.js:18:14)\n    at Compiler.compile (C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\Compiler.js:1092:28)\n    at C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\Compiler.js:517:12\n    at Compiler.readRecords (C:\\Users\\JFJ\\AppData\\Roaming\\npm\\node_modules\\webpack\\lib\\Compiler.js:929:11)"}],"warningsCount":1,"children":[]}


0
1
Mr_Max
你这个生成的结果里看上去有报错啊。 ``` "configuration\nThe 'mode' option has not been set, webpack will fal...```
2021-11-27
共1条回复

Mr_Max

2021-10-22

同学你好!

应该是生成的stats.json文件有问题,你看它里面有内容吗?这个插件主要就是解析json,把数据可视化一下。

0
2
jy_li
生成的内容我贴在评论区了
2021-10-22
共2条回复

前端性能优化企业级解决方案 6大角度+大厂视野

只要项目还在线,性能优化永远是时刻要关注的问题

1109 学习 · 226 问题

查看课程