Typescript: Cannot find module 'source-map' - uglify.js

Update:

After installing this package I get the above error:

npm install @types/html-webpack-plugin --save-dev

Uninstalling it solves the problem.


  • C:\WINDOWS\system32>node -v v9.5.0
  • C:\WINDOWS\system32>npm -v 5.6.0
  • C:\WINDOWS\system32>tsc -v Version 2.7.1
  • VS Code: v1.20
  • Win 10 x64

When I run tsc in the root of my project folder, I now get the following error:

tsc

node_modules/@types/uglify-js/index.d.ts(9,32): error TS2307: Cannot find module 'source-map'.

I can't remember what I changed, but it was working before...

enter image description here

enter image description here

tsconfig.json:

{
  "compilerOptions": {
    "module": "esnext", // esnext to have support for Dynamic Module Imports
    "target": "es5",
    "rootDir": "src",
    "sourceMap": true,
    "lib": [
      "es2015",
      "dom"
    ]
  }
}