zouhir / jarvis

A very intelligent browser based Webpack dashboard
5.44k stars 191 forks source link

Support for MultiCompilers #119

Open Jack89ita opened 6 years ago

Jack89ita commented 6 years ago

Hi! As the title says i would like to know if this plugin supports the multicompilers mode of webpack; I have multiple entries but i can make this plugin works only for one. Anyone can help me? Thanks

stephencookdev commented 6 years ago

I imagine this one would require a bit of discussion before implementing. Namely, what would the expected behaviour be when running in multicompiler mode?

Should Jarvis show multiple tabs in its display, each tab showing the output from each compiler?

Or should Jarvis try and average out all of the data for each compiler, as if it's just running through 1 compiler?

For now, as a workaround, if you wanted something closer to the separate tabs route, you could just make multiple Jarvis servers running on different ports, e.g.:

const compiler1Config = {
  plugins: [new Jarvis({ port: 1337 })]
};
const compiler2Config = {
  plugins: [new Jarvis({ port: 1338 })]
};

module.exports = [compiler1Config, compiler2Config]

And then you should a Jarvis server for each compiler, running on http://localhost:1337 and http://localhost:1338

Jack89ita commented 6 years ago

For my personal use it should be good to open 2 instances on different ports, but when i try to do it as you suggest the second one ovveride the first one. This is what i'm trying to do:

plugins.push(
  new Jarvis({
    port: 1337
  })
);

pluginsCSS.push(
  new Jarvis({
    port: 1338
  })
);

But only port 1338 works. Any suggest?

stephencookdev commented 6 years ago

Just double checked, doing 2 server works for me.

Are you sure you're not just having issues with the plugins config in general (e.g. if you keep everything as it is now, but remove the pluginsCSS.push(new Jarvis({ port: 1338 })), does the 1337 server still work?

And when you say 1337 isn't working... what are you seeing exactly? Console errors in the terminal? Console errors in the dashboard? The server crashing?

Jack89ita commented 6 years ago

Yes, with only one instance of the plugin everything is working fine. When i use both ports, in port 1338 all is working, but in port 1337 it seems to not even open the connection, in fact the browser can't reach that port.

stephencookdev commented 6 years ago

Is it possible for you to share your whole webpack config? (or a subset of it which still exhibits the same issue)

Jack89ita commented 6 years ago

Sure, i can share a small subset, hope it will be useful:

let   plugins = [];
let   pluginsCSS = [];

plugins.push(
  new Jarvis({
    port: 1337
  })
);

pluginsCSS.push(
  new Jarvis({
    port: 1338
  })
);

module.exports = [{
  //JS Stuff
  entry: {
    ...
  },
  output: {
    ...
  },
  module: {
    ...
  },
  plugins: plugins
},{
  //CSS Stuff
  entry: {
    ...
  },
  output: {
    ...
  },
  module: {
    ...
  },
  plugins: pluginsCSS
}]

plugins and pluginsCSS are arrays where i store various plugins as Jarvis.

stephencookdev commented 6 years ago

But how are the plugins and pluginsCSS variables instantiated and populated? It'd be great if you could include a webpack config that we can drag&drop into our workspace, so we can run it locally and reproduce the issue

Jack89ita commented 6 years ago

I edited the aswer to show you the declarations on the variables e how are populated. If you still need the webpack config i can send it to you if you explain me how. Thanks