Ionic 2+ build unexpectedly won't build with --prod flag (npm run ionic:build --prod) for web? Fix.
Problem
Randomly my Ionic app would not build for web in --prod mode (ionic serve was fine). I was getting the error:
typescript error: Cannot find type definition file for '@types'
Solution
- Add to tsconfig.json file compilerOptions branch:
"compilerOptions": {
...
"types": [
"node"
]
...
},
Now when you run 'npm run ionic:build --prod', it should build without crapping out.
D
Comments: