Skip to content

css modules are being imported as .filename.module without .css extension #3206

Closed
@dbzx10299

Description

@dbzx10299

Environment



Version

v3

Reproduction

Clone the repository

git clone https://github.com/dbzx10299/content-test.git

Run npm install and npm run dev.

Here is a live example and there is no error in production

https://content-test.netlify.app/

Description

Clone the repository and run npm run build => npm run dev. When the page is running locally, check the the directory .nuxt/content/components.ts file and notice the following line

export const HeroModule = () => import('./../../pages/(home)/components/Hero/hero.module')

This produces a vite error and it can't find the file because the .css extension is missing.

[plugin:vite:import-analysis] Failed to resolve import "./../../pages/(home)/components/Hero/hero.module" from ".nuxt/content/components.ts". Does the file exist?

This issue seems to also not happen in production only in development, but it is still a problem because there is an error overlay on the screen.

Additional context

No response

Logs

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv3

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions