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
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 }
Solution from 2018:
Just install the typings for webpack-env
npm i @types/webpack-env -D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With