Missing preload-helper export in vite package when building Nuxt 3 app

Viewed 1133

I'm creating an Nuxt 3 application and it works fine when i run npm run dev. Though when I want to build the app with npm run build I get this error:

[vite:resolve] Missing "./preload-helper" export in "vite" package

I'm using Nuxt version 3.0.0-rc.6

My package.json

{
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "test:unit": "vitest --config ./vitest.config.js"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "~3.0.0",
    "@vue/test-utils": "~2.0.0",
    "jsdom": "~20.0.0",
    "nuxt": "3.0.0-rc.6",
    "sass": "^1.53.0",
    "sass-loader": "^13.0.2",
    "vitest": "~0.18.0"
  }
}

My nuxt.config.ts

import { defineNuxtConfig } from 'nuxt';

export default defineNuxtConfig({
  autoImports: {
    dirs: [
      // Scan composables from nested directories
      'composables/**'
    ]
  },
  css: ["@/assets/styles/main.scss"],
  vite: {
      css: {
          preprocessorOptions: {
              scss: {
                additionalData: '@import "@/assets/styles/variables.scss";'
              }
          }
      }
  }
})

My tsconfig.json

{
  // https://v3.nuxtjs.org/concepts/typescript
  "extends": "./.nuxt/tsconfig.json"
}

I've been looking for an answer for a while now in the documentation, Stackoverflow and Google - but I didn't come any closer to a solution.

Does anyone know what this error means and how I can fix it? Thanks in advance

1 Answers

Same Problem for me - in my case i had dependencies to vite 3.x. For the moment set Vite version to 2.9.14 fixed my build problem.

Related