Latest npm version (2.0.3) throws an error TypeError: (0 , $parcel$interopDefault(...)) is not a function
dominik992 opened this issue · 4 comments
I use react-pdf. And when building the project, I get this:
node_modules/fontkit/dist/main.cjs:5665
106 | (0, ($parcel$interopDefault($elh9A$swchelperslib_ts_decoratejs)))([
107 | ^
108 | TypeError: (0 , $parcel$interopDefault(...)) is not a function
109 | at Object. (/codebuild/output/src2739081922/src/backend/node_modules/fontkit/dist/main.cjs:5665:66)
110 | at Module._compile (node:internal/modules/cjs/loader:1358:14)
111 | at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
112 | at Object.require.extensions. [as .js] (/codebuild/output/src2739081922/src/backend/node_modules/ts-node/src/index.ts:1608:43)
113 | at Module.load (node:internal/modules/cjs/loader:1208:32)
114 | at Function.Module._load (node:internal/modules/cjs/loader:1024:12)
115 | at Module.require (node:internal/modules/cjs/loader:1233:19)
116 | at require (node:internal/modules/helpers:179:18)
117 | at Object. (/codebuild/output/src2739081922/src/backend/node_modules/@react-pdf/font/lib/index.cjs.js:11:15)
118 | at Module._compile (node:internal/modules/cjs/loader:1358:14)
119 | at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
120 | at Object.require.extensions. [as .js] (/codebuild/output/src2739081922/src/backend/node_modules/ts-node/src/index.ts:1608:43)
121 | at Module.load (node:internal/modules/cjs/loader:1208:32)
122 | at Function.Module._load (node:internal/modules/cjs/loader:1024:12)
123 | at Module.require (node:internal/modules/cjs/loader:1233:19)
124 | at require (node:internal/modules/helpers:179:18)
+1. Same issue here. I'll post if I figure it out.
Update:
Specifically, in the uncompiled code, the error occurs at the ts decorator at:
https://github.com/foliojs/fontkit/blob/master/src/CmapProcessor.js#L216C4-L216C9
The $parcel$interopDefault
is trying to load the decorator helper function __decorate
from tslib, but what it is receiving back is not a function. Is this a compatibility issue with tslib?
In other words: require("@swc/helpers/lib/_ts_decorate.js")
is not returning a function. Can anyone determine why?
I encountered the same error. I had to add the following to my package.json file to avoid it.
"resolutions": {
"fontkit": "2.0.2"
}
This was pinned in #344 due to a security vulnerability. Seems like we have to upgrade a bunch of stuff to the latest version to fix this instead.
I pushed out v2.0.4 which should hopefully fix the issue.