typescriptwebpackwebpack-3

webpack - Property context does not exist on type NodeRequire


I want to use: require.context('../images/', true, /\.(png|ico|svg|jpg|gif)$/)

but I get the following error:

Property context does not exist on type NodeRequire


Solution

  • Just install the typings for webpack-env

    npm i @types/webpack-env -D