title: How i can fix this error message with pdfjs-dist and angular?
body: <p>I install pdfjs-lib in project angular for convert PDF to canvas after I get this error message:</p>
  <pre><code>Error: ./node_modules/pdfjs-dist/build/pdf.js 2094:26
  Module parse failed: Unexpected token (2094:26)
  File was processed with these loaders:
   * ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
   * ./node_modules/@ngtools/webpack/src/ivy/index.js
  You may need an additional loader to handle the result of these loaders.
  |   async destroy() {
  |     this.destroyed = true;
  &gt;     await this._transport?.destroy();
  |     this._transport = null;
  | 
  </code></pre>
  <p>the goal is to convert the PDF page to canvas before rendering in HTML :</p>
  <pre><code>import * as pdfjslib from 'pdfjs-dist';
  pdfjslib.getDocument(url).promise.then(async(pdf) =&gt; {
          pdf.getPage(1).then(async (page) =&gt; {
            let viewport = page.getViewport({ scale: 0.3 });
            let canvas =&lt;HTMLCanvasElement&gt; document.getElementById(&quot;card&quot;+pageId);
            let context =&lt;CanvasRenderingContext2D&gt; canvas.getContext(&quot;2d&quot;);
            canvas.width = viewport.width;
            canvas.height = viewport.height;
            await page.render({
              canvasContext: context,
              viewport: viewport
            });
            resolve(&quot;ok&quot;);
          }).catch((err) =&gt; {
            reject(&quot;Erreur sur le pdf!!&quot;);
          });
        }).catch((err) =&gt; {
          reject(&quot;Erreur sur le pdf!!&quot;);
         });
  </code></pre>