noname0310 / babylon-mmd-viewer

MMD viewer powered by Babylon.js and babylon-mmd
https://babylon-mmd-viewer.vercel.app
MIT License
8 stars 1 forks source link

Vite Implementation with MMD WASM #1

Open SavAct opened 2 hours ago

SavAct commented 2 hours ago

I am using your project with Vite instead of Webpack, because it loads way faster. But I do not get it to run by using the mmd wasm libraries. Do you mind showcasing a Vite implementation instead of webpack? In any case, I appreciate your work.

noname0310 commented 1 hour ago

It will take me a while as I have never used vite before. I'll create a showcase and share the link here

SavAct commented 45 minutes ago

This is my vite.config.js that works with the non wasm implementation of babylon-mmd:

import { defineConfig } from 'vite'
import basicSsl from '@vitejs/plugin-basic-ssl'
import { viteStaticCopy } from 'vite-plugin-static-copy'

export default defineConfig({   
  plugins: [
    basicSsl(),
    viteStaticCopy({
      targets: [
        { src: ['res/*', '!res/private_test'], dest: './res' },
      ]
    }),
  ],
  optimizeDeps: {
    exclude: ['@babylonjs/havok'],
},
server: {
    host: '0.0.0.0',
    port: 20310,
    https: true,
  },
  build: {
    rollupOptions: {
      output: {
        entryFileNames: 'assets/[name]-[hash].js',
      }
    }
  },
})