Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not find #2839

Closed
petrecheli opened this issue Aug 11, 2020 · 13 comments
Closed

Not find #2839

petrecheli opened this issue Aug 11, 2020 · 13 comments

Comments

@petrecheli
Copy link

https://unpkg.com/jspdf@latest/dist/jspdf.min.js

jsPDF not find jspdf.min.js in the last version

@PublyaDev
Copy link

PublyaDev commented Aug 11, 2020

I guess they changed it for better integration with node or something... having the same problem... try using this: <script src="https://unpkg.com/[email protected]/dist/jspdf.min.js"></script>
the before last version is still up.

@petrecheli
Copy link
Author

i fixed using, npm install jspdf...

then import jsPDF from 'jspdf';

on vue btw

@ewahner
Copy link

ewahner commented Aug 11, 2020

Their current build doesn't produce a jspdf.min.js. Also might want to change your description to 404 Not Found.

@HackbrettXXX
Copy link
Collaborator

The file has been renamed to jspdf.umd.(min).js. We recommend loading the library from npm and using import { jsPDF } from 'jspdf'. See also the release notes and the readme.

@bcazu
Copy link

bcazu commented Aug 11, 2020

not use https://unpkg.com/jspdf@latest/dist/jspdf.min.js because you will be use the last version. use https://unpkg.com/[email protected]/dist/jspdf.min.js for don't have problems whit last version and others implements

@Raycon983
Copy link

Same problem here, the new version cause the "not found jsPDF" problem.

@HackbrettXXX
Copy link
Collaborator

Either use 1.5.3 or upgrade to 2.0.0. Depending on "latest" in a production application is never a good idea.

@Manikanta-20
Copy link

@HackbrettXXX
After Updating latest version...facing below issue

warn -   ./node_modules/jspdf/dist/jspdf.umd.min.js
Critical dependency: the request of a dependency is an expression

What is the Solution ?

@lanlin
Copy link

lanlin commented Aug 13, 2020

jspdf version: 2.0.0

node version: v14.4.0

yarn version: v1.22.4

import { jsPDF } from 'jspdf';
 WARNING  Compiled with 2 warnings                      10:01:20 AM

 warning  in ./node_modules/jspdf/dist/jspdf.umd.min.js

Critical dependency: the request of a dependency is an expression

 warning  in ./node_modules/jspdf/dist/jspdf.umd.min.js

Critical dependency: the request of a dependency is an expression

@HackbrettXXX
Copy link
Collaborator

Please give more details: which build tool? How do you import jspdf, etc.

@Manikanta-20
Copy link

Manikanta-20 commented Aug 13, 2020

Please give more details: which build tool? How do you import jspdf, etc.

@HackbrettXXX
if we importing jspdf through import /require getting those warnings for latest version

sample code:

const { jsPDF } = require('jspdf');
 const doc = new jsPDF();
doc.setFont('times', 'normal');
doc.setFontSize(11);
doc.text(10, 20, 'text');
doc.save('sample.pdf');


@daviseford
Copy link

daviseford commented Aug 13, 2020

A quick workaround to hide the error for now:

My project uses create-react-app under the hood so I have to use a config-overrides.js file to make this adjustment, but here's the gist of it.

First, install webpack-filter-warnings-plugin

yarn add -D webpack-filter-warnings-plugin

And add this rule to your Webpack config:

const FilterWarningsPlugin = require('webpack-filter-warnings-plugin')

module.exports = {
  // Your Webpack config...

  // This prevents `jspdf` from throwing useless errors during the build process
  config.plugins.push(
    new FilterWarningsPlugin({
      exclude: /Critical dependency: the request of a dependency is an expression/,
    })
  )

}

The error is hidden, which I think is acceptable for end users right now.

@HackbrettXXX
Copy link
Collaborator

Closing in favor of #2846

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants