Troubleshooting issues in Safari's Web Inspector while utilizing a module loader such as SystemJS

I am currently developing an Angular application using es6 modules, TypeScript, and SystemJS as the module loader. This is my current configuration:

tsconfig.json:

{
  "compilerOptions": {
    ...
    "target": "es5",
    "module": "system",
    ...
  }
}

index.html:

<script src="lib/system.js"></script>
<script src="systemjs.config.js"></script>
<script>System.import('js/app.js')</script>

sample script (TypeScript):

import {IConfig} from "./app-config";

export class ConfigLoader {
    ...
}

While everything functions smoothly on Chrome, I encountered issues when attempting to debug using Safari's Web Inspector. It appears that breakpoints cannot be set in scripts loaded via XHR (such as those loaded by SystemJS), only in scripts directly connected through HTML script tags. As a result, debugging becomes challenging.

In an attempt to address this issue, I tried incorporating script tags alongside SystemJS in the html file:

<script src="lib/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="js/app-config.js"></script>
 ... additional app scripts
<script>System.import('js/app.js')</script>

Unfortunately, this approach was unsuccessful as SystemJS did not seem to respond positively:

Invalid System.register call. Anonymous System.register calls can only be made by modules loaded by SystemJS.import and not via script tags.

I am seeking advice on how to utilize SystemJS while ensuring the ability to debug effectively in Safari. A more sophisticated solution than simply inserting debugger statements in each script would be greatly appreciated.

Answer №1

If you're looking for a reliable IDE option, consider using a tool like WebStorm that comes with a robust Debugger for both Web and Node applications.

Here are some examples:

To learn more about the WebStorm debugger, check out the link here.

If you're considering alternatives to WebStorm, here are a few options:

  1. Atom (Free)
  2. Intellij IDEA (community: Free)
  3. Visual Studio Code (Free)
  4. ...

P.S: I personally use WebStorm for developing Ionic and React apps :D

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Extract the value of an HTML tag and assign it to a variable

Can someone help me out with this, as I am not very familiar with Smarty: When I use ajax to submit this form: <form accept-charset="UTF-8" method="post" onSubmit="return validate()"> <input type="text" name="code" maxlength="15" class=" ...

Switching iFrame based on dropdown selection

Hello, I'm a beginner in the world of programming and I'm currently experimenting with creating a webpage. However, I've encountered a roadblock and could use some help. My current goal is to change the source of an iFrame to a specific link ...

What is the best method to send a JSON object from an Ajax call to an ASP.net page?

Anyone know why this code is failing to send JSON objects to a MVC controller via POST? Any suggestions? JS function Update() { var objects = $(".Classes"); items = []; objects.each(function () { items .push({ ...

Unable to supersede CSS module styling using global or external stylesheets in React, Next.js, or React Native

I'm facing a challenge finding a solution to a basic issue. I have a component that is initially styled using a class from a *.module.css file. However, I want to replace this style with one from a global stylesheet or another stylesheet but I can&apo ...

Can we avoid the addition of a 'children' element by JSX comment, potentially causing issues with types?

Imagine having a third party library structured like this: declare var SomeComponentFromLibrary: React.FC<{ children?: React.ReactElement }>; Within the library's definition, children is set to be a React.ReactElement, and altering this det ...

issue encountered during the conversion from kml to geojson format

I've been working on converting a KML file to geojson for D3, but I ran into an issue: getElementsByTagName() is not a function when running the following script in my browser: <script> $.ajax('data/District.kml' ...

Currently experimenting with jQuery in conjunction with the reddit API to generate individual divs for every post

Issue with displaying post titles, URLs, and permalinks separately. Need them to display together for each post. See the code below: $(document).ready(function() { $.getJSON( "http://www.reddit.com/r/pics.json?jsonp=?", function foo(data) { ...

Sharing images on Facebook via a page

My website features an image slider with a Facebook share button for each image. I want the specific image to be posted along with the current URL when the share button is clicked. The script I am using is as follows: <script type="text/javascript"> ...

Connection to MondoDB via MongoClient in a Node.js environment has encountered an error and cannot

I've been attempting to establish a connection with my local MongoDB using the MongoDB NPM Package. Below is the code that I have been using: var express = require("express"); var router = express.Router(); var MongoClient = require('mongodb&apos ...

Exploring the JSON object tree through recursion using underscore and backbone

If I have a JSON object with nested arrays of unknown depths and I want to pass each array into a _.template function, how can I make that happen? Here's an example of what my JSON object might look like: $start_elements = array ( array( ...

The identical items combined into a single array

I have a specific data structure that I am struggling to manipulate in JavaScript. The goal is to merge objects with the same invoice_nr into one array, while keeping other objects in separate arrays. const result = [ { invoice_nr: 16, order_id: ...

Converting PDO Fetch results into JSON using PHP

Trying to execute a MySQL query in a PHP file and return the results in JSON format to a Javascript function. PHP code: require_once("class.user.php"); $auth_user = new USER(); $stmt = $auth_user->runQuery(" SELECT * FROM projects; " ...

Node inadvertently triggers functions with similar names from a different module

Currently, I am developing a web application using Node and the Express framework. Within my project, I have organized two modules, CreateAccountService.js and LoginService.js, in the "service" directory. Each module currently only exports one function. ...

CoffeeScript:: I can't understand why the function body returns when using ajax

Hey there, I'm new to Coffeescript and have a question regarding Ajax. jQuery -> api = getId: -> res = [] $.ajax dataType: "jsonp" url: "http://localhost:3004/videos.json" success: (data) => ...

What is the method to launch a new window containing multiple tabs using JavaScript?

Is there a way to open a link in a new window that opens multiple tabs simultaneously? I am currently able to open multiple tabs within the same window using the code snippet below: $('a.yourlink').click(function(e) { e.preventDefault(); ...

Undefined value for req.query in Node.js Express

When working with Node.js and Express 4.7.2, I'm running the code below: express.get('/test1',function(req, res) { var ttt = false; if (req.query.username === undefined) ttt = true; res.json({query: ttt}); }); After calling the URL: ...

Oops! Looks like we couldn't locate the request token in the session when attempting to access the Twitter API

Every time I attempt to connect to the Twitter API using Passport OAuth, an issue arises that redirects me to an error page displaying this message: Error: Failed to locate request token in session at SessionStore.get (/Users/youcefchergui/Work/ESP/socialb ...

Parsing JSON multiple times to extract data on the top 10 games from Twitch's API

Hey there! I have a little coding challenge for you. The current code below is only fetching the first channel from the JSON. My goal is to fetch all the streams and display them in a grid format with three streams per row. Can you help me achieve this? (B ...

Matching Tables with JavaScript and JSON

After hours of coding, I'm stuck on a simple task and could really use some assistance. The "users" object contains user account information, with the function "get" meant to retrieve matching objects from this array. var users = [ { name ...

Building an array from scratch in Angular

Below is the URL to access the code: https://stackblitz.com/edit/ng-zorro-antd-start-xz4c93 Inquiring about creating a new array. For example, upon clicking the submit button, the desired output should resemble the following structure: "tasks": [ { ...