目录

What should I do if sourcemaps are not generated during uni-app compilation?

Symptom

During the compilation of a uni-app project, sourcemap files are not generated, which prevents developers from debugging the source code effectively.

Solution

For CLI compilation, set the following environment variables:

Windows (32-bit): set UNI_SOCKET_HOSTS=0.0.0.0 && set UNI_SOCKET_PORT=9876 && set UNI_SOCKET_ID=1
macOS: export UNI_SOCKET_HOSTS=0.0.0.0 && set UNI_SOCKET_PORT=9876 && set UNI_SOCKET_ID=1

The compilation output should then include sourcemaps as shown below.

For HBuilderX compilation, update to the latest IDE version.