Skip to content

Commit 6bc2c7b

Browse files
committed
Fix asyncImportHelper rollup preprocessing in karma configs
The asyncImportHelper.ts files need special handling because they use ES module imports that should not be transpiled to CommonJS. This commit: 1. Excludes asyncImportHelper files from Babel compilation in package.json 2. Processes asyncImportHelper.ts files with rollup preprocessor in karma configs 3. Fixes typescript plugin configuration (options should be direct properties, not nested in compilerOptions) The rollup preprocessor preserves ES imports which allows asyncImportHelper to dynamically import the ES module build at runtime. Verified locally that: - Build completes successfully - Test compilation excludes asyncImportHelper files - Rollup preprocessor correctly processes asyncImportHelper.ts - Node.js tests pass (444 specs, 0 failures)
1 parent 1f38543 commit 6bc2c7b

File tree

11 files changed

+62
-30
lines changed

11 files changed

+62
-30
lines changed

dist/jspdf.es.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/** @license
22
*
33
* jsPDF - PDF Document creation from JavaScript
4-
* Version 3.0.3 Built on 2025-11-10T03:53:15.852Z
5-
* CommitID 8aec1cf947
4+
* Version 3.0.3 Built on 2025-11-10T04:12:59.142Z
5+
* CommitID 1f385431cc
66
*
77
* Copyright (c) 2010-2025 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
88
* 2015-2025 yWorks GmbH, http://www.yworks.com

dist/jspdf.es.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/** @license
22
*
33
* jsPDF - PDF Document creation from JavaScript
4-
* Version 3.0.3 Built on 2025-11-10T03:53:15.884Z
5-
* CommitID 8aec1cf947
4+
* Version 3.0.3 Built on 2025-11-10T04:12:59.178Z
5+
* CommitID 1f385431cc
66
*
77
* Copyright (c) 2010-2025 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
88
* 2015-2025 yWorks GmbH, http://www.yworks.com

dist/jspdf.node.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jspdf.umd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/** @license
22
*
33
* jsPDF - PDF Document creation from JavaScript
4-
* Version 3.0.3 Built on 2025-11-10T03:53:15.818Z
5-
* CommitID 8aec1cf947
4+
* Version 3.0.3 Built on 2025-11-10T04:12:59.108Z
5+
* CommitID 1f385431cc
66
*
77
* Copyright (c) 2010-2025 James Hall <[email protected]>, https://github.com/MrRio/jsPDF
88
* 2015-2025 yWorks GmbH, http://www.yworks.com

dist/jspdf.umd.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/polyfills.es.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/polyfills.umd.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"lint": "prettier --check \"*.{js,ts,md,css,json}\" \"{spec,examples,src,types}/**/*.{js,ts,md,css,json}\"",
118118
"pregenerate-docs": "node deletedocs.ts",
119119
"generate-docs": "jsdoc -c jsdoc.json --readme README.md",
120-
"compile-tests": "babel test --out-dir test/compiled --config-file ./.babelrc.test.json --extensions .ts,.js --copy-files --ignore \"**/*.conf.js\",\"**/karma.common.conf.js\",\"**/jasmine.json\",\"test/compiled/**\""
120+
"compile-tests": "babel test --out-dir test/compiled --config-file ./.babelrc.test.json --extensions .ts,.js --ignore \"**/*.conf.js\",\"**/karma.common.conf.js\",\"**/jasmine.json\",\"**/asyncImportHelper.*\",\"test/compiled/**\",\"**/reference/**\" && find test/compiled -name \"asyncImportHelper.js\" -delete"
121121
},
122122
"browserslist": [
123123
"last 2 versions"

test/deployment/esm/karma.conf.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const karmaConfig = require("../../karma.common.conf.js");
22
const resolve = require("rollup-plugin-node-resolve");
33
const commonjs = require("rollup-plugin-commonjs");
4+
const typescript = require("@rollup/plugin-typescript");
45

56
module.exports = config => {
67
config.set({
@@ -20,7 +21,7 @@ module.exports = config => {
2021
"test/compiled/deployment/esm/loadGlobals.js",
2122

2223
{
23-
pattern: "test/compiled/deployment/esm/asyncImportHelper.js",
24+
pattern: "test/deployment/esm/asyncImportHelper.ts",
2425
included: true,
2526
watched: true,
2627
type: "module"
@@ -32,33 +33,40 @@ module.exports = config => {
3233
pattern: "test/compiled/specs/*.spec.js",
3334
included: true,
3435
watched: true,
35-
served: true,
36-
36+
served: true
3737
},
3838
{
3939
pattern: "test/**/*.+(svg|png|jpg|jpeg|ttf|txt)",
4040
included: false,
41-
served: true,
41+
served: true
4242
},
4343
{
4444
pattern: "test/reference/**/*.pdf",
4545
included: false,
4646
watched: false,
47-
served: true,
47+
served: true
4848
}
4949
],
5050

51+
preprocessors: {
52+
...karmaConfig.preprocessors,
53+
"test/deployment/esm/asyncImportHelper.ts": ["rollup"]
54+
},
5155

5256
rollupPreprocessor: {
53-
plugins: [resolve(), commonjs()],
57+
plugins: [
58+
typescript({
59+
tsconfig: false,
60+
module: "esnext",
61+
target: "es2015"
62+
}),
63+
resolve(),
64+
commonjs()
65+
],
5466
output: {
55-
format: "iife",
56-
name: "jspdf",
67+
format: "esm",
5768
sourcemap: "inline"
58-
},
59-
external: Object.keys(
60-
require("../../../package.json").optionalDependencies
61-
)
69+
}
6270
},
6371

6472
browsers: ["Chrome", "Firefox"]

0 commit comments

Comments
 (0)