0

I am using Highcharts with Angular. I am getting some console error in highStock.js file due to my code. enter image description here

I want to debug it, but HighStock.js is loaded as minified version. How can I force the app to load highstock.src.js instead so it is more readable? I am using webpack

"scripts": {
"ng": "ng",
"nx": "nx",
"start": "ng serve",
"build": "ng build --prod",
"build:stats": "ng build --prod --statsJson",
...
 },

"dependencies": {
"@angular/animations": "^9.0.0",
"@angular/cdk": "^9.0.0",
"@angular/common": "^9.0.0",
"@angular/compiler": "^9.0.0",
"@angular/core": "^9.0.0",
"@angular/forms": "^9.0.0",
  ...
"file-saver": "^2.0.2",
"highcharts": "^8.0.0",
"highcharts-angular": "^2.4.0",
"highcharts-custom-events": "^3.0.2",
"js-cookie": "^2.2.1",
"json2csv": "^5.0.0",
"lodash.clonedeep": "^4.5.0",
"ng2-tooltip-directive": "^2.8.17",
"ng5-slider": "^1.2.4",
"ngx-daterangepicker-material": "^2.1.11",
"ngx-pagination": "^5.0.0",
"rxjs": "~6.5.4",
"text-mask-addons": "^3.8.0",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
 },
 "devDependencies": {
"@angular-builders/custom-webpack": "^9.1.0",
"@angular-builders/dev-server": "^7.3.1",
"@angular-devkit/build-angular": "^0.900.7",
"@angular/cli": "9.0.1",
"@angular/compiler-cli": "^9.0.0",
"@angular/language-service": "^9.0.0",
"@arkweid/lefthook": "^0.7.1",
"@ngxs/devtools-plugin": "^3.6.2",
 ...
"typescript": "~3.7.5",
"highcharts": "^8.0.0",
"highcharts-angular": "^2.4.0",
"highcharts-custom-events": "^3.0.2",
"webpack": "^4.43.0",
"webpack-bundle-analyzer": "^3.6.0"
}

TIA

user4772933
  • 311
  • 3
  • 13
  • How are you getting `highStock`? Using npm? Does it come with an unminified distributable? – Halcyon Feb 22 '21 at 11:50
  • I use webpack config updated above, it has a dependency highcharts-angular , This dependency is a wrapper for highcharts.. And yes i used npm to install the dependencies and I use ng serve to run the application – user4772933 Feb 22 '21 at 11:55
  • @Halcyon it didn't work, what you suggested below. Can you give other suggestions please – user4772933 Feb 22 '21 at 13:41

1 Answers1

0

This might work:

Open node_modules/highcharts/package.json and change

...
"main": "highcharts.js"
...

to:

...
"main": "highcharts.src.js"
...

This change will be lost whenever you update your node_modules.

Halcyon
  • 57,230
  • 10
  • 89
  • 128
  • Didnt work, Do i need to clean/remove something/folder? Just stopping the app and making the above change and restarting the app, didnt work. Also I cleared browser cache so it does not use old version. The browser fetches from webpack:///C:/PATH/node_modules/highcharts/highstock.js – user4772933 Feb 22 '21 at 12:49