Forum Discussion

Master_T's avatar
Master_T
Helper I
4 years ago

Using a library that uses private fields in a custom visual

Hello everyone

I'm developing a custom visual where I want to use the PDF.js library to display a PDF document.

 

The problem I'm having is that if I include it and try to use it in my custom visual (the package I'm using is: https://www.npmjs.com/package/pdfjs-dist ) the visual fails to compile, giving me the following error:

 

 

ERROR in ./node_modules/pdfjs-dist/build/pdf.js 4248:26
Module parse failed: Private field '#docStats' must be declared in an enclosing class (4248:26)
File was processed with these loaders:
* ../../../../AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.

 

 

From what I'm reading online, this problem can be solved by correctly configuring webpack in some way, but I'm a bit out of my depth here and don't know where to start tinkering. Does anyone have any tips on how to fix this issue?

No RepliesBe the first to reply