Entry module not found: Error: Can't resolve './src when running webpack --stats=detailed --json > compilation-stats.json

Viewed 199

I am trying to analyze a Webpack bundle using webpack-bundle-analyzer, however it needs a JSON file that's generated by Webpack.

My code repo is available at https://github.com/hhimanshu/material-icons

I am using Webpack v4, and tried the following command:

./node_modules/.bin/webpack --stats=detailed --json > compilation-stats.json

It generates the file, but it contains errors. I am not sure what they mean and how to resolve them. Could someone please guide me?

{
  "errors": [
    "Entry module not found: Error: Can't resolve './src' in '/Users/hhimanshu/Downloads/exp/material-icons'\nresolve './src' in '/Users/hhimanshu/Downloads/exp/material-icons'\n  using description file: /Users/hhimanshu/Downloads/exp/material-icons/package.json (relative path: .)\n    Field 'browser' doesn't contain a valid alias configuration\n    using description file: /Users/hhimanshu/Downloads/exp/material-icons/package.json (relative path: ./src)\n      no extension\n        Field 'browser' doesn't contain a valid alias configuration\n        /Users/hhimanshu/Downloads/exp/material-icons/src is not a file\n      .wasm\n        Field 'browser' doesn't contain a valid alias configuration\n        /Users/hhimanshu/Downloads/exp/material-icons/src.wasm doesn't exist\n      .mjs\n        Field 'browser' doesn't contain a valid alias configuration\n        /Users/hhimanshu/Downloads/exp/material-icons/src.mjs doesn't exist\n      .js\n        Field 'browser' doesn't contain a valid alias configuration\n        /Users/hhimanshu/Downloads/exp/material-icons/src.js doesn't exist\n      .json\n        Field 'browser' doesn't contain a valid alias configuration\n        /Users/hhimanshu/Downloads/exp/material-icons/src.json doesn't exist\n      as directory\n        existing directory\n          using path: /Users/hhimanshu/Downloads/exp/material-icons/src/index\n            using description file: /Users/hhimanshu/Downloads/exp/material-icons/package.json (relative path: ./src/index)\n              no extension\n                Field 'browser' doesn't contain a valid alias configuration\n                /Users/hhimanshu/Downloads/exp/material-icons/src/index doesn't exist\n              .wasm\n                Field 'browser' doesn't contain a valid alias configuration\n                /Users/hhimanshu/Downloads/exp/material-icons/src/index.wasm doesn't exist\n              .mjs\n                Field 'browser' doesn't contain a valid alias configuration\n                /Users/hhimanshu/Downloads/exp/material-icons/src/index.mjs doesn't exist\n              .js\n                Field 'browser' doesn't contain a valid alias configuration\n                /Users/hhimanshu/Downloads/exp/material-icons/src/index.js doesn't exist\n              .json\n                Field 'browser' doesn't contain a valid alias configuration\n                /Users/hhimanshu/Downloads/exp/material-icons/src/index.json doesn't exist"
  ],
  "warnings": [
    "configuration\nThe 'mode' option has not been set, webpack will fallback to 'production' for this value. Set '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/"
  ],
  "version": "4.44.2",
  "hash": "8c1514714b7e0e358033",
  "time": 36,
  "builtAt": 1626278696261,
  "publicPath": "",
  "outputPath": "/Users/hhimanshu/Downloads/exp/material-icons/dist",
  "assetsByChunkName": {},
  "assets": [],
  "filteredAssets": 0,
  "entrypoints": {},
  "namedChunkGroups": {},
  "chunks": [],
  "modules": [],
  "filteredModules": 0,
  "logging": {
    "webpack.buildChunkGraph.visitModules": {
      "entries": [],
      "filteredEntries": 1,
      "debug": false
    }
  },
  "children": []
}
0 Answers
Related