Kitware / paraviewweb

Web framework for building interactive visualization relying on VTK or ParaView to produce visualization data
http://kitware.github.io/paraviewweb/
BSD 3-Clause "New" or "Revised" License
165 stars 51 forks source link

React Widgets static without interaction #448

Closed marvinrea closed 6 years ago

marvinrea commented 6 years ago

Hi, I launched a React project with create-react-app then I ejected webpack config and I installed paraviewweb as this doc : https://kitware.github.io/paraviewweb/docs/setup.html

but .mcss files seems to not work when I add a React Widget like LookupTableWidget :

capture d ecran de 2018-04-04 16-54-59

Is this a common issue ? I did not find anything

jourdain commented 6 years ago

How do you build your app? mcss is just a modular css where class composition can be achieved as well as name mangling. A rule should be defined to load them. Otherwise you should get an error message when building. Based on the information you are provided, it is hard to pin-point the missing part.

marvinrea commented 6 years ago

Thank you, RemoteRenderer works fine in my app but not widgets

I have no error message when building This is my webpack config to build the app: I import the rules : capture d ecran de 2018-04-05 09-06-02

and I include paraviewweb and wslink paths in loaders: capture d ecran de 2018-04-05 09-08-50

Here is the file (converted in txt for git): webpack.config.prod.txt

jourdain commented 6 years ago

So the part you commented was indeed wrong

/*
      {
        test: /\.(sass|scss|mcss)$/,
        loaders: ['style-loader', 'css-loader', 'sass-loader', 'mcss-loader',
          {
            loader: 'postcss-loader',
            options: {
              plugins: () => [autoprefixer('last 2 version', 'ie >= 10')],
            },
          }],
      },
*/

Here is the rule that we use to load mcss in ParaViewWeb https://github.com/Kitware/paraviewweb/blob/master/config/rules-pvw.js#L21-L39

marvinrea commented 6 years ago

Ok now I have these errors: capture d ecran de 2018-04-05 16-51-57

and this on opera: capture d ecran de 2018-04-05 16-58-52

webpack.config.dev.txt

jourdain commented 6 years ago

It seems you are using Webpack 1? Why is your configuration file so complex? Can you use a more recent version? What about using this as a starting point? http://kitware.github.io/paraviewweb/docs/setup.html#Creating-your-own-project

marvinrea commented 6 years ago

I started with create-react-app which creates its own configuration, if you want to customize it you have to run the eject script that give you a lot of complex files.

jourdain commented 6 years ago

You can see here how the loaders are defined for webpack@1.

https://github.com/Kitware/paraviewweb/blob/v2.5.4/config/webpack.loaders.js#L19-L22

jourdain commented 6 years ago

as well as the config https://github.com/Kitware/paraviewweb/blob/v2.5.4/documentation/content/docs/setup.md

jourdain commented 6 years ago

By using such an old version of webpack you will be missing a lot of optimization... You should really try to setup your project by yourself.

marvinrea commented 6 years ago

Ok I tried this, it seems to work

{ test: /.mcss$/, loader: 'style!css?modules&importLoaders=1&localIdentName=[name][local][hash:base64:5]!postcss', },

Thank you I will try to setup by myself with webpack 2

jourdain commented 6 years ago

Go with webpack 4 if you can...