webpack - Property context does not exist on type NodeRequire
Solution from 2018:
Just install the typings for webpack-env
npm i @types/webpack-env -D
And in tsconfig.json add it in the types property example:
{
"compilerOptions": {
"outDir": "./dist/",
"declaration": true,
"declarationDir": "./dist/",
"sourceMap": true,
"noImplicitAny": false,
"module": "commonjs",
"target": "es6",
"allowJs": false,
"types": [
"node",
"webpack-env" // here
]
},
"files": [
"src/index.ts"
],
"compileOnSave": false
}