Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
-3
rated 0 times [  4] [ 7]  / answers: 1 / hits: 17707  / 7 Years ago, sat, september 30, 2017, 12:00:00

enter



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



enter



work file like this ⬆️


More From » reactjs

 Answers
47

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



Edit
If you are using css-modules, you can define these types to match the return value:



declare module '*.less' {
const resource: {[key: string]: string};
export = resource;
}


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



// tsconfig.json
{
compilerOptions: {...}
includes: [
'./path/to/the/new/file/externals.d.ts'
]
}

[#56347] Wednesday, September 27, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jadon

Total Points: 488
Total Questions: 105
Total Answers: 105

Location: Trinidad and Tobago
Member since Thu, Dec 1, 2022
2 Years ago
;