Jqui
Jqui

Reputation: 53

Parcel reference static file in js module

I'm using parcel to develop a three.js based app. But it seems that loading a 3d model is not working because of a non correct path.

I have a model in src/assets/models/mymodel.obj and want to use it inside the obj loader but this relative path is not working.

I tried to add a static folder in the build but referencing to it is also not working.

I tried also to create a specific url with : new URL('model.obj', import.meta.url)

But still not working..

Any tips ?

thanks in advance

Upvotes: 0

Views: 454

Answers (1)

Jqui
Jqui

Reputation: 53

found it !

juste use :

model = require(path/to/file)

loader.load(model)

Upvotes: 1

Related Questions