https://unpkg.com/jspdf@latest/dist/jspdf.min.js
jsPDF not find jspdf.min.js in the last version
I guess they changed it for better integration with node or something... having the same problem... try using this:
the before last version is still up.
i fixed using, npm install jspdf...
then import jsPDF from 'jspdf';
on vue btw
Their current build doesn't produce a jspdf.min.js. Also might want to change your description to 404 Not Found.
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.
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
Same problem here, the new version cause the "not found jsPDF" problem.
Either use 1.5.3 or upgrade to 2.0.0. Depending on "latest" in a production application is never a good idea.
@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 ?
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
Please give more details: which build tool? How do you import jspdf, etc.
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');
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.
Closing in favor of #2846
Most helpful comment
@HackbrettXXX
After Updating latest version...facing below issue
What is the Solution ?