Debugging a Marko.js application can be done using standard JavaScript debugging tools. Here are a few tips:
Use Browser Developer Tools: Utilize the browser's developer tools to inspect elements, view console messages, and debug JavaScript code.
Enable Source Maps: Ensure source maps are enabled in your build configuration to make debugging easier by mapping compiled code back to the original source.
Logging: Use console.log
to output debugging information in your templates and scripts.
Debugging in VSCode:
- Install the Debugger for Chrome extension.
- Set up a launch configuration in
launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}
By following these practices, you can effectively debug your Marko.js application.