Debug custom code

Feedback


Configure debugging environment

Debugging custom code requires the MapDashboard WebApp as the debugging environment. So, before debugging, you need to do the following configurations:

  1. In the build directory of the project, open the webpack.dev.conf.js file, and modify the value of iportalUrl to the iPortal service address you're using. As follows:

const iportalUrl = 'http://localhost:8190/iportal';

  1. Since the port used in the development environment is inconsistent with the iPortal service port, there will be cross-domain problems when accessing service. Please open the web.xml in the [iPortal product package] /webapps/iportal/WEB-INF directory and do the following configuration:

<init-param>

  <param-name>cors.allowed.origins</param-name>

  <!-- Please set the port to the port used by the development environment -->

  <param-value>http://localhost:8080</param-value>

</init-param>

<init-param>

    <param-name>cors.support.credentials</param-name>

    <param-value>true</param-value>

</init-param>

Debug code

After configuring the debugging environment, execute the following command in the root directory of the project:

npm start

or

npm run dev

After the command is executed, the browser will automatically open the debugging service address: http://localhost:8080/md/index.html. Click "Components" in the left panel of the interface, find and drag the extended component to the right panel, you can view, debug, and modify the code in real time.

 

Note: Before executing the debugging command, please make sure that the iPortal service has been started, otherwise you will not be able to access http://localhost:8080/md/index.html during debugging.