I am currently on a project developed width Ionic4 and Capacitor.
I want, when building my project on a smartphone (Android), get the source-map files ".ts". For now, I only have the source-map files ".scss" and ".html".
Here are all the tests of build that I tried
package.json
"scripts": {
"android": "npx cap copy && npx cap open android", // And sync if necessary
"build_1: "ng build && npm run android",
"build_2: "ng build --sourceMap && npm run android",
"build_3: "ionic build && npm run android",
"build_4: "ionic build --source-map && npm run android",
}
I also tried to add this
"config": {
"ionic_generate_source_map": "true",
"ionic_source_map_type": "inline-source-map" // Or eval-source-map
}
Then, finding no solution, I tried webpack.
Inside package.json
"config": {
"ionic_webpack": "./webpack.config.js"
}
Inside webpack.config.js
const process = require('process');
const useDefaultConfig = require('@ionic/app-scripts/config/webpack.config.js');
const env = process.env.IONIC_ENV;
if (env === 'dev' || env === 'development') {
useDefaultConfig[env].devtool = 'inline-source-map';
}
module.exports = () => useDefaultConfig;
Then, once the compilation is finished, I launch the project with Android Studio.
I inspect the sources with Chrome inspect and I only get the sources of the "html" and "scss" files, but not "TypeScript".
Does anyone have a magic idea ?
Ionic:
Capacitor:
Cordova:
Utility:
System:
tsconfig.json
...
"lib": ["dom", "es6"],
"module": "es6",
"target": "es6",
"sourceMap": true
...
I found a solution to my problem.
I use the command npm run build_r define in package.json
scripts: {
"build_r": "ionic capacitor run android --source-map --livereload"
}
below which allows me to access the source-map
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.