Typescript IMPORT Global node_ Modules error

There is a node in the project_The package of modules is too large. You have to download it for half a day every time you put it in the docker, which greatly reduces the deployment efficiency

Therefore, consider installing the node package globally into the basic image of docker, so the code can directly reference the global package

It was found that require succeeded, but import failed. The error message is similar as shown in the figure:

 

It turns out that the module loading method of typescript is different

Solution:

Configure typescript.json and solve it through path mapping

 

Reference link  

Similar Posts: