Mesh-BVH Error in Container from Needle Script

Hello,

I got the same error than Mesh-BVH compilation error from Needle package

But only when I deploy my code in a container (image node:18.17.1-alpine).

Here the error :

X [ERROR] No matching export in “external:three-mesh-bvh” for import “MeshBVH”

node_modules/@needle-tools/engine/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js:2:9:
  2 │ import { MeshBVH } from 'three-mesh-bvh';
    ╵          ~~~~~~~

Here my vite config :

import { defineConfig } from 'vite';
import viteCompression from 'vite-plugin-compression';

export default defineConfig(async ({ command, mode }) => {
    const { needlePlugins, useGzip, loadConfig } = await import("@needle-tools/engine/plugins/vite/index.js");
    const needleConfig = await loadConfig();

    // Détermine si nous sommes en mode développement
    const isDevelopment = mode === 'development';

    return {
        base: "./",
        plugins: [
            useGzip(needleConfig) ? viteCompression({ deleteOriginFile: true }) : null,
            needlePlugins(command, needleConfig, { noPoster: true }),
        ],
        server: isDevelopment
            ? {
                  host: '0.0.0.0',
                  port: 5173,
                  https: false,
                  strictPort: true,
                  hmr: {
                      protocol: 'ws',
                      host: 'localhost',
                      port: 5173,
                  },
              }
            : undefined, // Pas de configuration du serveur en production
        build: {
            outDir: "./dist",
            emptyOutDir: true,
            keepNames: true,
        },
    };
});

Do you have an idea to resolve it ?

Hi @Robin_Lasserye please don’t open duplicate topics