-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Windows 11 22H2
VS Code 1.84.2
CSS Modules extension 0.5.1
Not sure if it is a bug or I am just missing some additional config. It works without alias.
Steps:
- Open new vscode window.
- Create empty vscode profile (File - Preferences - Profiles - Create Profile) and switch to it.
- Create nextjs project with src dir and without app router and tailwind:
npx create-next-app@latest
√ What is your project named? ... my-app
√ Would you like to use TypeScript? ... Yes
√ Would you like to use ESLint? ... Yes
√ Would you like to use Tailwind CSS? ... No
√ Would you like to use src/ directory? ... Yes
√ Would you like to use App Router? (recommended) ... No
√ Would you like to customize the default import alias (@/*)? ... No
Generated project will have:
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
and import styles from '@/styles/Home.module.css' in my-app\src\pages\index.tsx
- Install CSS modules extension
- Go to
my-app\src\pages\index.tsxand try going to existing classes and autocomplete - it does not work. - Change import to
import styles from '../styles/Home.module.css'- it starts working.
AFatNiBBa and sethstha
Metadata
Metadata
Assignees
Labels
No labels