目录

Compiling and Debugging a Quick App

Customizing Compilation Settings

Huawei Quick App IDE allows you to customize compilation settings so you can define some required paths during compilation. The customization method is as follows:

Create the quickapp.config.js file in the root directory of your project. Add the following configuration to the file:

module.exports = {
  sourceRoot: './src',
  signRoot: './sign',
  releasePath: './dist',
  outputPath: './build',
  lintOnBuild: true,
}

The settings in the previous file content are all default values.

In addition, Huawei Quick App IDE also supports customization of resolve, module, plugins, and node. The method is similar to that of webpack.

For example, to support TypeScript-based development of your project, you can add the following content to the quickapp.config.js file:

module.exports = {
    webpack: {
        module: {
            rules: [{
                test: /\.tsx?$/,
                loader: 'babel-loader',
                options: {
                  presets: [
                    '@babel/preset-env',
                    '@babel/preset-typescript'
                  ]
                },
                exclude: /node_modules/,
            }]
        },
        resolve: {
        mainFields: ['quickapp', 'main', 'module', 'browser'],   // Default configurations since 3.1.1-Stable.300
        }
    }
}

Since the preceding code involves the dependency configuration @babel/preset-typescript, you need to go to the TERMINAL tab page in Huawei Quick App IDE and run the npm i -D @babel/preset-typescript command to install the dependency.

Compiling the Quick App in Real Time

  1. After completing debugging device connection and debugging parameter setting, click Run. The Selecting Running Device page will be displayed if this is the first compilation.

  2. Click Confirm. The IDE projects the screen of your mobile phone, and the target page or card file is rendered on the mobile phone.

  3. Modify the content of the UX file and save it. The IDE automatically compiles the file and records the compilation result in logs. The preview page of the mobile phone on the right is updated in real time to display the modified content.

  4. Click the Stop button to end real-time compilation. The projected quick app screen is then closed.

Debugging Your Quick App on a Real Device

  1. After completing debugging device connection and debugging parameter setting, click Debug. The Selecting Running Device page will be displayed if this is the first debugging.

  2. Click Confirm to start debugging. Upon the output of the log information "COMPILE RESULT:SUCCESS {"WARN":, "NOTE":}", open the DEVTOOL panel and start the device screen projection.
    • If any error information is displayed, the debugging fails to be started and the debugging process exits. In this case, modify your code and start debugging again.
    • If you are using a VM-based device (for example, desktop cloud) for debugging, and the projected screen is all black, but your mobile phone can be operated normally, access \.quickapp-ide\quickscrcpy\config in the user directory, open the config.ini file, change the value of the UseDesktopOpenGL field to 0, and restart the IDE.

  3. Go to DEVTOOL > Sources > Page > Runtime.js > Webpack, find the page file, set breakpoints, and start debugging.

  4. Click the icon in the following figure to display the debugging console in a new window.

  5. Click the debug button again to stop the debugging. The permanent projection of the mobile phone is disabled on the right. The log "Debugging service has been closed" is recorded.

Starting Inspection

  1. After completing debugging device connection and debugging parameter setting, click Inspect. The Selecting Running Device page will be displayed if this is the first inspection.

  2. Click Confirm to start inspection. Upon the output of the log information "COMPILE RESULT:SUCCESS {"WARN":,"NOTE":}", open the inspection window and start the device screen projection.

  3. Click a specific area to check elements and VDOM information of the area. However, you cannot perform style debugging in this mode.

  4. Check information about network requests and storage in the DEVTOOL panel and capture packets.

Debugging Your Quick App in WebView

The WebView debug tool is used to debug HTML5 quick apps.

Detailed operations are as follows:

The WebView debug tool can debug only the page displayed on the device, if you close this page during debugging, the tool will display a blank page.

Links

[h2]FAQs