1

I've created a vendor module according to UMD and set jsPDF as a dependency. How do I achieve, that jsPDF-AutoTable plugin will be registered with jsPDF before injecting jsPDF into my vendor module?

I've already solved jsPDF is not defined using ProvidePlugin in my webpack.config.js file like this:

config.plugins = [
    new webpack.ProvidePlugin({
        jsPDF: 'jspdf'
    })
]
4

2 回答 2

2

在 jspdf 自动表存储库中有一个如何使用 webpack 的示例基本上你只需要在jspdf之后需要插件。

var jsPDF = require('jspdf');
require('jspdf-autotable');

您不需要将提供程序插件与最新版本的 jspdf 一起使用。

于 2017-05-11T17:49:54.003 回答
0

使用以下导入组合,这也适用于 webpack

从“jspdf”导入jsPDF;

要求(“jspdf-autotable”);

于 2020-05-06T11:48:47.520 回答