ionic-frameworkcapacitorionic-react

Ionic React build without minification


I am trying to run the script

ionic build

But the generated build version is always with --production flag. Thus my js/ts code is minified and not suitable for debugging. Do you know a way to build in dev mode?

output of "ionic build"

The command "ionic build -- --mode development" which seems to work for Vue does not seem to work for React.


Solution

  • Ionic React uses Create React App under the hood. This means that you can use CRA build commands instead of Ionic.

    As described in this gist, you need to enable profiling mode for CRA to get unminified output.

    You can do this with the command react-scripts build -- --profile.

    To make it easier, you can add a command to scripts in your package.json like:

       "build-profile": "react-scripts build -- --profile",