李子朋 李子朋 - 3 years ago 208
React JSX Question

typescript can't find module less

enter image description here

I use react and webpack to build web SPA but, typescript can't find resolve the less file

enter image description here

work file like this ⬆️

Answer Source

Just create a new declaration file (externals.d.ts) with declare module '*.less'.

Add that file to the includes array of your tsconfig.json file.

// tsconfig.json
{
   compilerOptions: {...}
   includes: [
      './path/to/the/new/file/externals.d.ts'
   ]
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download