Removing the check fixes the problem.
A solution would be to bypass the check if the file has a .js ext or completely removing the check but don't know if that impacts something else, didn't dig too much into the code.
Aside from the modifications you've made to make it work, I've found that using an absolute .js path also make it work. It is not very usefull to me but perhaps it might help you.
Trying to import a .js file as this
will throw the following error.
The problem seems to be with the import path, the issue seems to be in this check that will not fail https://github.com/KrysKruk/serverless-import-config-plugin/blob/6df1d651aa03f7e84daa5d24753561df0399fe54/src/index.ts#L60 but the subsequent require will. https://github.com/KrysKruk/serverless-import-config-plugin/blob/6df1d651aa03f7e84daa5d24753561df0399fe54/src/index.ts#L144
Removing the check fixes the problem. A solution would be to bypass the check if the file has a .js ext or completely removing the check but don't know if that impacts something else, didn't dig too much into the code.