Typescript Cannot Find Module './lib'
Solution 1:
Ah! So, after much trial and error it turned out the main culprit was:
"allowJs":true,For some reason it was copying some parts of node_modules to ./dist one of those files was as you can see in the error:
dist/node_modules/winston-aws-cloudwatch/index.js
Now the problem was two fold
I did not know whether
node_modulesshould be copied todist. I thought all of it should go. Which is WRONG.None of
node_modulesshould go indist, the compiled files shall referpathsto figure out the location ofnode_modules.The second problem was I could not see error go away when, in the fit of agony, I was switching on and off all the
tsconfigoptions and rerunning the build. The reason was,distDOES NOT CLEAR OFF. I figured this by an obscure luck while repeating the same process umpteenth time!
Anyway, good learning. Hope some of it would help someone someday.
Post a Comment for "Typescript Cannot Find Module './lib'"