Home > Mobile >  How to enable reactivityTransform in Nuxt 3?
How to enable reactivityTransform in Nuxt 3?

Time:06-06

I want to enable Vue 3 experimental feature reactivityTransform in Nuxt 3 (3.0.0-rc.3). I've tried the solution provided here, but it did not work and I did get the following error:

Type '{ vue: { reactivityTransform: true; }; }' is not assignable to type 'UserConfig'.

Here is my nuxt.config.ts file:

import { defineNuxtConfig } from "nuxt";

export default defineNuxtConfig({
  vite: {
    vue: {
      reactivityTransform: true
    }
  },
});

Any idea about what am I doing wrong? How can I enable reactivityTransform in Nuxt 3?

CodePudding user response:

Apparently in the current version of Nuxt 3 (3.0.0-rc.3), instead of modifing the vite config in the nuxt.config file, we should add an experimental proprety; The following code enabled reactivityTransform in Nuxt 3:

// nuxt.config.ts
import { defineNuxtConfig } from "nuxt";

export default defineNuxtConfig({
  experimental: {
    reactivityTransform: true
  },
});

Here is the related link.

  • Related