Using Vue + BabylonJS (NPM ES6 ver), and I don't know how to find assets's path after build

Hi I’m trying to use BabylonJS with VueJS.
And I use Firebase Hosting as Server.

Before I deploy files in “dist/”, I build the project using the comand

npm run build

In package.json, this command is defined as

vue-cli-service build

And here comes the problem,
I want to use SceneLoader inside a component, but I don’t know the path of my assets after build.
My .glb model was in “(project root)/src/assets/scences/mymodel.gld”, but simply refering to this path after build like this
BABYLON.SceneLoader.ImportMesh("", "../assets/scenes/", "nice_rigged_man.glb", ...
doesn’t work.

Where should I put my models before build?
Where should I refer for my models after build?

As the Vue Build Doc says, you should put your model assets in

(project root)/src/public/assets

After build, files in the folder above are now in

(project root)/dist/assets/

And after you deploy, dist/ is your root directory now, so you can access to your models by assets/(model file name)

2 Likes