xtk / X

The X Toolkit
http://www.goXTK.com
Other
793 stars 265 forks source link

react and xtk #205

Open ghost opened 6 years ago

ghost commented 6 years ago

Ive been using the XTK library for some scientific 3D modeling applications, and I am trying to use it in react. The library works flawlessly on its own in JavaScript but when I try to implement it in react it tells me that I need a loader for an unspecified file type. How would I figure out what the file type is? and why is this issue happening. package docs: https://www.npmjs.com/package/xtk

here is the implementation of xtk in code:

var r = new  window.X.renderer3D();
//r.container = 'r';
r.init();

// create a mesh from a .vtk file
var skull = new window.X.mesh();
skull.file = 'http://x.babymri.org/?avf.vtk';

// add the object
r.window.X.add(skull);

// .. and render it
r.render();

And here is the error message I am getting: image

xgui3783 commented 6 years ago

Looks like a webpack warning? Are you using webpack for your project?

On Mon, Jul 30, 2018, 19:11 malinged notifications@github.com wrote:

Ive been using the XTK library for some scientific 3D modeling applications, and I am trying to use it in react. The library works flawlessly on its own in JavaScript but when I try to implement it in react it tells me that I need a loader for an unspecified file type. How would I figure out what the file type is? and why is this issue happening. package docs: https://www.npmjs.com/package/xtk

here is the implementation of xtk in code:

var r = new window.X.renderer3D(); //r.container = 'r'; r.init();

// create a mesh from a .vtk file var skull = new window.X.mesh(); skull.file = 'http://x.babymri.org/?avf.vtk';

// add the object r.window.X.add(skull);

// .. and render it r.render();

And here is the error message I am getting: [image: image] https://user-images.githubusercontent.com/35342569/43412070-ec1c8644-93e0-11e8-8940-97f264e0fba9.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xtk/X/issues/205, or mute the thread https://github.com/notifications/unsubscribe-auth/ASe-F0ISS1ORexkl6PV62Ihg5la-uxEoks5uLz5IgaJpZM4VmzxB .

sraksh commented 5 years ago

Hi,

This might be happening due to not having rules defined in your webpack to load a certain file type. Kindly check after adding this to your webpack config rules:

test: /.(dcm)(\?.*)?$/, loader: 'file-loader', options: { name: '[name].[ext]', },

change the file extension as per your need. Let us know if this worked?