balm-ui icon indicating copy to clipboard operation
balm-ui copied to clipboard

Documentation - Instructions on how to setup balm for Nuxt 3

Open TomMiller-mas opened this issue 3 years ago • 9 comments

I am new to Nuxt and balm and would appreciate it if someone has already done this, that they put instruction here. I will update them as I follow them with additional detail so they can eventually be used for documentation. Thanks!

TomMiller-mas avatar Mar 07 '22 05:03 TomMiller-mas

Hi @TomMiller-mas ,

Currently nuxt3 is still in beta stage, so no UI integration solution is provided for now, you can refer to nuxt3 with BalmUI example to start your nuxt3 project

elf-mouse avatar Mar 07 '22 06:03 elf-mouse

If you leave this open, I will try to make some notes from a newbie's point of view.

TomMiller-mas avatar Mar 07 '22 17:03 TomMiller-mas

How to Install Balm-UI for nuxt.js v3 beta/rc:

Install nuxt v3
npx nuxi init <app name>

Install Balm-UI v10. As of this writing, v10 is still in development. npm i balm-ui@next

WIP

TomMiller-mas avatar Mar 07 '22 19:03 TomMiller-mas

  • config nuxt.config.ts

    import { defineNuxtConfig } from 'nuxt3';
    
    export default defineNuxtConfig({
      alias: {
        vue: 'vue/dist/vue.esm-bundler.js',
        'balm-ui-plus': 'balm-ui/dist/balm-ui-plus.esm.js'
      },
      css: ['balm-ui/dist/balm-ui.css'],
      ssr: false // for NOW
    });
    
  • add plugins/balm-ui.js

    import { defineNuxtPlugin } from '#app';
    import BalmUI from 'balm-ui';
    import BalmUIPlus from 'balm-ui-plus';
    
    export default defineNuxtPlugin((nuxtApp) => {
      nuxtApp.vueApp.use(BalmUI);
      nuxtApp.vueApp.use(BalmUIPlus);
    });
    

elf-mouse avatar Mar 08 '22 01:03 elf-mouse

With this sugessted configuration of nuxt.config.ts I got error:

Could not load ...\node_modules\vue\dist\vue.esm-bundler.js\server-renderer (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '...\node_modules\vue\dist\vue.esm-bundler.js\server-renderer'

tsrift avatar Nov 28 '22 17:11 tsrift

  • config nuxt.config.ts
export default defineNuxtConfig({
    alias: {
        vue: 'vue/dist/vue.esm-bundler.js',
        'balm-ui-plus': 'balm-ui/dist/balm-ui-plus.esm.js'
    },
    css: ['balm-ui/dist/balm-ui.css'],
    ssr: false // for NOW
});

Could not load ...\node_modules\vue\dist\vue.esm-bundler.js\server-renderer (imported by node_modules/nuxt/dist/core/runtime/nitro/renderer.mjs): ENOENT: no such file or directory, open '...\node_modules\vue\dist\vue.esm-bundler.js\server-renderer'

tsrift avatar Nov 28 '22 23:11 tsrift

Hi @tsrift , please update your nuxt.config.ts:

export default defineNuxtConfig({
  alias: {
    'balm-ui-plus': 'balm-ui/dist/balm-ui-plus.esm.js'
  },
  css: ['balm-ui/dist/balm-ui.css'],
  hooks: {
    'vite:extendConfig': (config, { isClient }) => {
      if (isClient) {
        config.resolve.alias.vue = 'vue/dist/vue.esm-bundler.js';
      }
    }
  },
  ssr: false
});

elf-mouse avatar Dec 01 '22 08:12 elf-mouse

Hi @elf-mouse . Can we use "ssr: true" for now ?

jonaskahn avatar Jun 10 '23 15:06 jonaskahn

Hi @therealtuyen , you can try v10.22.0 again

elf-mouse avatar Jun 15 '23 07:06 elf-mouse