Fix TS2307: Cannot find module '*.less' | ATLASSC.NET
Skip to main content
/// .DATA.FRAGMENT_20221002

Fix TS2307: Cannot find module '*.less'

1 minAuthor: Z.SHINCHVEN

TypeScript project reads module from declaration files, when the module is not defined or broken, tslint will throw an error like below:

TS2307: Cannot find module './index.less' or its corresponding type declarations.

To fix it, you must make sure your module is defined in one of any declaration files.

// declaration.d.ts
// declare module
declare module '*.scss';

// configure for css-modules
declare module '*.less' {
  const content: { [className: string]: string };
  export default content;
}

If the error exists, please check if there's an error in your declaration file. Make sure NOTHING OTHER THAN declare module is defined in the file, or it can't be recognized by TypeScript.

RackNerd Billboard Banner
Share node:
/// .RELATED.DATA_STREAMSShared tags

Related posts

Scanning_database_for_correlations…

/// .UPLINK.SUBSCRIBE

Keep your deck synced with every new transmission from ATLASSC.NET. Subscribe over RSS or Atom, or wire the whole archive straight into your AI assistant with the MCP server.