0

I'm trying to create a reusable SharePoint utility library. I want to use heft to build the library, because it will deal with scss typings, and both cjs/esm outputs.

However, SharePoint's dependencies contain unpublished internal dependencies (that's causing a lot of troubles, but that's another story). That should not, however, prevent compilation because these packages are already bundled and shipped as CJS.

When I use heft, however, I see heft trying to build source code of this packages, instead of just using its typing.

Error is : Error: node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@microsoft/sp-core-library/dist/index-internal.d.ts:13:71 - (TS2307) Cannot find module '@ms/odsp-core-bundle' or its corresponding type declarations.

I use the @rushstack/hef-web-rig package to simplify config.

I created a small repro: https://github.com/stevebeauge/heft-sp.git.

git clone https://github.com/stevebeauge/heft-sp.git
cd heft-sp
pnpm i
pnpm build

How can I solve my issue?

I also tried to manually compile (w/o heft) using: pnpm tsc -b but it does not compiles

1 Answer 1

0

Found the missing piece:

"skipLibCheck": true

in the tsconfig.json make the compiler ignore the dependencies in compiling.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.