productdevbook / oku-nuxt3-template

Nuxt 3 best starter repo, Tailwindcss, Sass, Headless UI, Vue, Pinia, Vite, Eslint, i18n, Naive UI
https://oku-nuxt3-template.vercel.app/
MIT License
602 stars 81 forks source link

unable to run preview or start #31

Closed billysean closed 2 years ago

billysean commented 2 years ago

Environment

Nuxt CLI v3.0.0-27376943.f219f63
RootDir: D:\project\nuxt3TemplateTailwind
Nuxt project info:


Describe the bug

INFO : This error is generated purely by cloning this git

ERROR DESC : building was successful but generates error when trying to run npm run start

'D:\project\test\nuxt3-app.output\server\node_modules\@heroicons\vue\outline' is not supported resolving ES modules imported from D:\project\test\nuxt3-app.output\server\chunks\server2.mjs

both for @heroicons/vue & @headlessui/vue generates this error

Additional context

No response

Logs

No response

nikita-komissarov commented 2 years ago

I'm already sent a pull request for this If you need an immediately fix on this:

In file nuxt.config.ts Add transpile: ['@heroicons/vue'] in build section, before postcss e.g. Finally run yarn build and yarn start

Full nuxt.config.ts for example:

import { defineNuxtConfig } from "nuxt3";

export default defineNuxtConfig({
    buildModules: [
        // pinia plugin - https://pinia.esm.dev
        "@pinia/nuxt",
    ],
    build: {
        transpile: ['@heroicons/vue'],
        postcss: {
            postcssOptions: {
                plugins: {
                    tailwindcss: {},
                    autoprefixer: {},
                },
            },
        },
    },
    vite: {
        logLevel: "info",
        optimizeDeps: {
            include: [
                '@headlessui/vue', '@heroicons/vue/solid', '@heroicons/vue/outline', 'vue', 'pinia'
            ]
        }
    }
});