Closed IlyaSemenov closed 1 year ago
@IlyaSemenov Hello! I am not too familiar with Nuxt. Could you try to specify it inside of nuxt-config/vite with enforce: pre option and see if it works?
It fails to starts: https://stackblitz.com/edit/nuxt-starter-r5dkaz?file=app.vue,nuxt.config.ts
ERROR You gave us a visitor for the node type requeueComputedKeyAndDecorators but it's not a valid type
at verify (node_modules/vite-plugin-vue-css-modules/node_modules/@babel/traverse/lib/visitors.js:92:13)
at explode (node_modules/vite-plugin-vue-css-modules/node_modules/@babel/traverse/lib/visitors.js:26:3)
@IlyaSemenov It was an issue with babel libs versions. I've updated them along with some qol changes. Update plugin to the latest 3.1.3 version. It should work now
// app.vue
<template>
<div class="test">hello</div>
</template>
<style module>
.test {
color: red;
}
</style>
// nuxt.config
import { cssm } from "vite-plugin-vue-css-modules";
export default defineNuxtConfig({
vite: {
plugins: [cssm()],
},
});
I confirm that it works now: https://stackblitz.com/edit/nuxt-starter-cp8xnr?file=app.vue,nuxt.config.ts
Thanks!
@IlyaSemenov great! Just make sure to enable scriptTransform
if you're using removeCssModulesChunk
Is there a recipe to use this with Nuxt 3?