[vtkusers] VTK-js: how to read a .json file
Scott Wittenburg
scott.wittenburg at kitware.com
Fri Jul 21 11:50:45 EDT 2017
Hi Cristina,
In vtk.js we now use webpack2 (in master at least, you may have picked an
older version though), and the webpack2 documentation states that you no
longer need a loader for json:
https://webpack.js.org/guides/migrating/#json-loader-is-not-required-anymore
Is your project also using webpack2? In that case you shouldn't need the
json loader. Also, when you refer to "Build-in modules of Node.js", does
that refer specifically to this:
https://github.com/sindresorhus/builtin-modules
or do you mean something else?
Cheers,
Scott
On Fri, Jul 21, 2017 at 8:57 AM, Aron Helser <aron.helser at kitware.com>
wrote:
> Hi Cristina,
> ParaViewWeb uses this webpack 1.x loader:
> {
> test: /\.json$/,
> loader: 'json-loader',
> },
> That should allow you to 'include' a json file in your javascript, and
> then you might need to use the built-in JSON.parse() to turn it into an
> object.
>
> Regards,
> Aron
>
> On Fri, Jul 21, 2017 at 4:43 AM, Cristina Oyarzun via vtkusers <
> vtkusers at vtk.org> wrote:
>
>> Dear all,
>>
>> I visualized several actors using VTK-js. Now I want to read a .json file
>> and according to the information that it is included there assign different
>> colors to the actors.
>>
>> Unfortunately as soon as I try to use the Build-in modules of Node.js I
>> start getting errors. I didnt manage to find out how do I have to adapt the
>> "webpack.config.js" (or the "package.json"?) so that it works.
>>
>> I found somewhere in a forum that it should work by adding " target:
>> 'node' " to the webpack.config.js but it didnt. Any help would be great!
>>
>> Thank you!
>> Cristina
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170721/d53de671/attachment.html>
More information about the vtkusers
mailing list