javascript - ionic 2 typescript 未建立來源地圖
我正在嘗試調試 Ionic 2 應用程式,我想知道如何為每個 TypeScript 檔案包含 sourceMap,以對應到 JavaScript 檔案。
但是當我在 Chrome 中打開開發者工具時,沒有任何 souceMap 文件。
此外,我在 tsconfig.json 文件中啟用了 "sourceMap":true。這是我的 tsconfig.json 文件
{
"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
}
}
之後,我嘗試根據這個「sourcemaps 不適用於 Ionic 2」修改 ionic.config.json,但對我來說也沒有用。
有人知道出了什麼問題嗎?
答案#1
找到了答案。
仍然沒有生成 .map 文件。因為這是一個錯誤,請參見這個問題。但現在在添加了這個之後我可以進行調試
"config":{
"ionic_source_map":"source_map"
}
到 package.json 檔案中。現在所有的 .ts 檔案都會在除錯模式中顯示。
答案#2
現在已經改為-
config: {
ionic_bundler: "webpack",
ionic_source_map_type: "#inline-source-map"
}
