Closed
Description
Link to the code that reproduces this issue
https://github.com/Demidog03/next-less-module-issue
To Reproduce
// TestComponent.tsx
'use client'
import React from 'react';
import styles from './TestStyles.module.less'
const TestComponent = () => {
return (
<div className={styles.class}>
</div>
);
};
export default TestComponent;
Error in local server:
CSS Modules cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-modules-npm
Location: src\TestComponent.tsx
Current vs. Expected behavior
Current behavior:
CSS Modules cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-modules-npm
Location: src\TestComponent.tsxImport trace for requested module:
./src/TestStyles.module.less
./src/TestComponent.tsx
Expected behavior:
Less module files works fine)
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 31832
Available CPU cores: 12
Binaries:
Node: 22.14.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.6.3
Relevant Packages:
next: 15.2.2 // There is a newer version (15.2.3) available, upgrade recommended!
eslint-config-next: 15.2.2
react: 19.0.0
react-dom: 19.0.0
typescript: 5.8.2
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Webpack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response