gevgeny / angular2-highcharts

:bar_chart: :chart_with_upwards_trend: Highcharts for your Angular project
MIT License
380 stars 113 forks source link

sourcemap(s) are causing warnings #99

Open Raymice opened 7 years ago

maxailloud commented 7 years ago

Nice one man, just a title and no explanation at all.

MattCain commented 7 years ago

@maxailloud i think they're referring to the same issue as #7 which is how I got here.

Using this package with webpack throws out some sourcemap errors:

WARNING in ./~/angular2-highcharts/dist/index.js
Cannot find source file '../src/index.ts': Error: Cannot resolve 'file' or 'directory' ../src/index.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/ChartComponent.js
Cannot find source file '../src/ChartComponent.ts': Error: Cannot resolve 'file' or 'directory' ../src/ChartComponent.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/ChartSeriesComponent.js
Cannot find source file '../src/ChartSeriesComponent.ts': Error: Cannot resolve 'file' or 'directory' ../src/ChartSeriesComponent.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/ChartPointComponent.js
Cannot find source file '../src/ChartPointComponent.ts': Error: Cannot resolve 'file' or 'directory' ../src/ChartPointComponent.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/ChartXAxisComponent.js
Cannot find source file '../src/ChartXAxisComponent.ts': Error: Cannot resolve 'file' or 'directory' ../src/ChartXAxisComponent.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/ChartYAxisComponent.js
Cannot find source file '../src/ChartYAxisComponent.ts': Error: Cannot resolve 'file' or 'directory' ../src/ChartYAxisComponent.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/HighchartsService.js
Cannot find source file '../src/HighchartsService.ts': Error: Cannot resolve 'file' or 'directory' ../src/HighchartsService.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/initChart.js
Cannot find source file '../src/initChart.ts': Error: Cannot resolve 'file' or 'directory' ../src/initChart.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/createBaseOpts.js
Cannot find source file '../src/createBaseOpts.ts': Error: Cannot resolve 'file' or 'directory' ../src/createBaseOpts.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/HighchartsWrapper.js
Cannot find source file '../src/HighchartsWrapper.ts': Error: Cannot resolve 'file' or 'directory' ../src/HighchartsWrapper.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/deepAssign.js
Cannot find source file '../src/deepAssign.ts': Error: Cannot resolve 'file' or 'directory' ../src/deepAssign.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

WARNING in ./~/angular2-highcharts/dist/ChartEvent.js
Cannot find source file '../src/ChartEvent.ts': Error: Cannot resolve 'file' or 'directory' ../src/ChartEvent.ts in /Users/matthewcain/Documents/kpmg-kosmos-webclient/node_modules/angular2-highcharts/dist

I have got rid of the errors for now by excluding sourcemaps from angular2-highcharts in the source-map-loader config in my webpack config file.

{
    test: /\.js$/,
    loader: 'source-map-loader',
    exclude: [
        // These packages have problems with their source maps;
        rootPath('node_modules/@angular'),
        rootPath('node_modules/@ngrx'),
        rootPath('node_modules/rxjs'),
        rootPath('node_modules/angular2-highcharts'), <-- This guy
    ]
},

As you can see it's a common problem. The version of ngrx i'm using has this issue but they appear to have since fixed the issue by using inline source in their sourcemaps, i.e. adding "inlineSources": true, to their tsconfig.json file.

@gevgeny I would be happy to submit a PR doing the same if that's a solution you're ok with?