question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jsPDF 2.0.0 - Critical dependency: the request of a dependency is an expression

See original GitHub issue

Packages: Node: 10.14.2 Angular: 10.0 jsPDF: 2.0.0

Problem: I just updated jsPDF from 1.5.3 to 2.0.0 in my Angular 10.0 project and suddenly experience following warning during building:

WARNING in ./node_modules/jspdf/dist/jspdf.umd.min.js 195:240-254
Critical dependency: the request of a dependency is an expression

Usage:

import { jsPDF } from "jspdf";
import html2canvas from 'html2canvas';

public savePDF(fileName: string) {

    /* tslint:disable */
    window['html2canvas'] = html2canvas;
    /* tslint:enable */

    const jspdf = new jsPDF({
      orientation: 'p',
      unit: 'pt',
      format: 'a4'
    });

    const canvas = this.canvas.nativeElement;

    try {
      jspdf.html(canvas, {
        html2canvas: {
          allowTaint: true,
          useCORS: true,
          scale: 600 / canvas.scrollWidth
        },
        callback: async (doc) => {
          doc.save(`${fileName}.pdf`);
          console.log('Success');
        }
      });
    } catch (error) {
      console.error(error);
    }
  }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:32
  • Comments:32

github_iconTop GitHub Comments

14reactions
HackbrettXXXcommented, Aug 21, 2020

Good to hear. Thanks.

I will prepare a new release next week.

9reactions
absolimancommented, Aug 13, 2020

I can add that also we found the below lines.

[ng] WARNING in ./node_modules/jspdf/dist/jspdf.umd.min.js 195:141-151 [ng] Critical dependency: the request of a dependency is an expression [ng] WARNING in ./node_modules/jspdf/dist/jspdf.umd.min.js 195:240-254 [ng] Critical dependency: the request of a dependency is an expression

Read more comments on GitHub >

github_iconTop Results From Across the Web

jsPDF 2.0.0 - Critical dependency: the request of a ... - GitHub
Packages: Node: 10.14.2 Angular: 10.0 jsPDF: 2.0.0 Problem: I just updated jsPDF from 1.5.3 to 2.0.0 in my Angular 10.0 project and suddenly ......
Read more >
Webpack - Critical dependency: the request of a dependency ...
When a library uses variables or expressions in a require call (such as require('' + 'nodent') in these lines of ajv ), Webpack...
Read more >
the request of a dependency is an expressio - You.com
Hi, I'm using treeviz with React 17 and I get error when build in the build server: Critical dependency: the request of a...
Read more >
jspdf - npm
Start using jspdf in your project by running `npm i jspdf`. There are 1012 other projects in the npm registry using jspdf.
Read more >
Bump jspdf from 1.5.3 to 2.3.1 (!8) - MPCDF Gitlab
#2865: Fix "Critical dependency: the request of a dependency is an expression" warning and loading of optional dependencies · #2872: Add support ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found