greetclock / angular-gauge-chart

Angular Gauge Chart
https://recogizer.github.io/gauge-chart/examples/samples/
MIT License
61 stars 41 forks source link

Unexpected token: punc ()) error in version 0.7.1 #28

Closed maihannijat closed 5 years ago

maihannijat commented 5 years ago

The version 0.7.1 throws error while building with --prod flag. Debug the error with the following line: ng build --prod --named-chunks --verbose --build-optimizer=false --source-map

And found the error on:

Unexpected token: punc ()) [./node_modules/gauge-chart/dist/bundle.js:169,0]

The line was causing the problem because of the trailing comma:

.attr(
  'transform',
  'translate(' + (n + 2 * e) + ', ' + (n + e) + ')',
)

Removed the trailing comma and tried to build again but the error continues to another line as the file has trailing commas. Finally, downgraded back to 0.6.0 and it works fine. This version contains the uglified code with no trailing commas but the latest version has pretty code but with trailing commas.

@NgModule({
  declarations: [XYZ],
  imports: [
    ...
    GaugeChartModule,
  ]
})

Just to add, I am using the library in my Angular 8 project - not directly building the library with --prod flag.

greetclock commented 5 years ago

@maihannijat thank you for pointing this out. Please, try the new version angular-gauge-chart@0.7.2 that I just published.

The problem was with gauge-chart dependency that stored compiled JS in a wrong way.

maihannijat commented 5 years ago

@cherurg Thanks for the quick fix.