Development Configuration

Last Updated on : 2024-06-14 18:13:32download

The micro.config.js file of a microapp is used to configure the local development features and the rules for building the output files.

Example

The following code block shows how to complete the development configurations of a project.

module.exports = {
  debuggerConfig: {
    target: 'host',
    username: 'xxx',
    password: 'zzz',
    logSign: true,
    mockPermissions: ['REGISTER', 'EDIT', 'DELETE'],
    themeConfig: {
      primaryColor: '#f50',
    },
  },
  webpack(config, { isDev, isBuild }) {
    config.output.publicPath = isDev ? '/' : './';
    return config;
  },
  devServer(config) {
    return config;
  },
};

debuggerConfig

Configure debugging features during microapp development.

  • target, username, and password: These fields can proxy the microapp to the created SaaS. During local startup, you can see what the microapp looks like in the SaaS.

  • logSign: Specifies whether to enable the request log output in the local development stage.

  • mockPermissions: Mock permissions. For more information, see Permission Configuration.

  • themeConfig: Configure the color scheme of the specified microapp. Currently, only primaryColor is supported.

    Configurations on the Tuya Developer Platform determine the color scheme when a SaaS application is running. Configurations herein only help adapt to the color scheme of a project during development, and they only take effect during local development and running.

webpack

Consistent with webpack, this parameter can be used to configure packaging rules.

devServer

Consistent with webpack - devServer, this parameter can be used to configure the server features during local development and running.