I’m facing an issue using a local piece (not yet published in the npm registry).
I have two pieces that use the same code to make some http requests. To share the code I created a new piece with the common code. As you have in ‘@activepieces/common’ but when loading the pieces I am receiving this error: ‘ERROR: Cannot find module’.
The error occurs in the ‘loadPieceFromFolder’ function when trying to import, but all the pieces are in the dist folder. Am I missing something?
So, we have a new piece ‘pieces-validator’ with shared code that is used in the pieces ‘sendy’ and ‘invoiceninja’. When loading the pieces in the ‘locadPieceFromFolder’ method in the ‘file-piece-metadata-service’ file, the ‘invoiceninja’ piece fails with this error ‘ERROR: Cannot find module’ when calling the ‘importFresh’ method.
Basically what I discovered is that we are not able to import a new local piece into the ‘index.ts’ of another piece.
I think in that case you have a new package. We do perform linking for the local environment, as these packages are not available in npm. The pnpm tries to download them from the internet, but they don’t exist. So, you have to explicitly do the linking in the local environment