Skip to content

Commit 247a0ae

Browse files
committed
Replace rollup typescript plugin with babel for asyncImportHelper preprocessing
The @rollup/plugin-typescript performs type-checking on all imported files, which generates hundreds of warnings for the jsPDF codebase. Since we only need to strip TypeScript type annotations from asyncImportHelper.ts (no actual type checking is needed), switching to @rollup/plugin-babel with @babel/preset-typescript provides a cleaner solution. Changes: - Replace typescript plugin with babel plugin in both karma configs - Use @babel/preset-typescript which only strips types (no type checking) - Verified locally that rollup processing completes with no TypeScript warnings This eliminates all the type-checking warnings while still correctly transpiling the asyncImportHelper.ts files to ES modules.
1 parent 6bc2c7b commit 247a0ae

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

test/deployment/esm/karma.conf.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +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");
4+
const { babel } = require("@rollup/plugin-babel");
55

66
module.exports = config => {
77
config.set({
@@ -55,10 +55,10 @@ module.exports = config => {
5555

5656
rollupPreprocessor: {
5757
plugins: [
58-
typescript({
59-
tsconfig: false,
60-
module: "esnext",
61-
target: "es2015"
58+
babel({
59+
babelHelpers: "bundled",
60+
extensions: [".ts", ".js"],
61+
presets: ["@babel/preset-typescript"]
6262
}),
6363
resolve(),
6464
commonjs()

test/unit/karma.conf.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const karmaConfig = require("../karma.common.conf.js");
44
const resolve = require("rollup-plugin-node-resolve");
55
const commonjs = require("rollup-plugin-commonjs");
6-
const typescript = require("@rollup/plugin-typescript");
6+
const { babel } = require("@rollup/plugin-babel");
77

88
module.exports = config => {
99
config.set({
@@ -41,10 +41,10 @@ module.exports = config => {
4141

4242
rollupPreprocessor: {
4343
plugins: [
44-
typescript({
45-
tsconfig: false,
46-
module: "esnext",
47-
target: "es2015"
44+
babel({
45+
babelHelpers: "bundled",
46+
extensions: [".ts", ".js"],
47+
presets: ["@babel/preset-typescript"]
4848
}),
4949
resolve(),
5050
commonjs()

0 commit comments

Comments
 (0)