4

I am trying to debug Ionic 2 Application And I want to know how to include souceMap for every typescript file that maps to the javascript files.

But when I open the dev tools in Chrome there is no any souceMap file.

Chrome-dev-tool-source-img

Also, I enabled the "sourceMap":true in tsconfig.json file. This is my tsconfig.json file

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5",
    "types": [
      "jasmine"
    ]
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

After that, I tried changing the ionic.config.json according to this sourcemaps not working for ionic 2. But it also did not work for me.

Does anyone know what is wrong?

Amr Eladawy
  • 4,193
  • 7
  • 34
  • 52
Ajantha Bandara
  • 1,473
  • 15
  • 36

2 Answers2

5

found the answer.

Still .map files are not generated. Because it is a bug see this issue. But now I can debug after adding this

"config":{

     "ionic_source_map":"source_map"
}

into package.json file. Now all the .ts files are shown in the debug mode.

Ajantha Bandara
  • 1,473
  • 15
  • 36
2

It has changed now to -

config: {
    ionic_bundler: "webpack",
    ionic_source_map_type: "#inline-source-map"
  }
vahid kargar
  • 800
  • 1
  • 9
  • 23
  • where should we put this line of code? To the `package.json` or `tsconfig.json`? Thanks. – Rich Sep 03 '18 at 07:34