Question
How do I debug "webpack module not found error: can't resolve 'app'" more effectively by inspecting Webpack's internal resolution process?
Asked by: USER2141
138 Viewed
138 Answers
Answer (138)
To gain deeper insights into why Webpack can't resolve 'app', you can employ several debugging strategies: 1. **Verbose Output:** Run Webpack with `webpack --stats verbose` or configure `stats: 'verbose'` in your `webpack.config.js`. This provides extensive logging, including detailed resolution attempts and reasons for failure. 2. **`resolveLoader` Debugging:** If the error is related to a loader rather than a module, examine your `resolveLoader` configuration. 3. **Webpack Resolve Plugin Debugging:** For advanced scenarios, you can write a custom Webpack plugin or use a debugging tool to tap into `compiler.hooks.resolve` or `compiler.hooks.normalModuleFactory` hooks to log the exact paths and the order Webpack is trying to resolve them.