I’m finding that any “debugger” lines are removed from my code when it’s compiled to the browser. I’ve tried a few methods to serve but my preference would be to be able to use debugger while in the lab.
The documentation doesn’t say much more than it should be possible. Is there a particular CLI flag that is needed to stop these commands being removed?
Have you got any error, any result, share what you tried…
It’s a bit hard to have an error when the code doesn’t exist. It just never gets included in the compiled JS. When I include source maps and am debugging, I can see the debugger line is greyed out which I gather is Chrome’s way of informing me that the line exists in the original file but does not exist in the compiled file.
I have had this same issue before with React and Webpack, and I’m running into it again as explained above by @HashNotAdam . I was able to fix it by changing the source map type for dev in the webpack.config.js from
cheap-eval-source-map to just
eval-source-map. It creates a larger source map, but it works really well for development. The problem is that you need to eject the application to do this.
Is there a way to extend the webpack.config.js in an ionic react application so that we can overwrite some of the values without ejecting the application?