rails/webpacker

Need a different webpack config based on the entry name

justin808 opened this issue · 3 comments

Per #732, we need to run the dev server like this:

Please turn off inline mode and dev server should work too: ./bin/webpack-dev-server --inline=false

This is one of a bunch of cases where we need a different webpack config for the server rendering bundle vs. the client bundles. Why? The client bundle is run in a browser, and the server bundle is on either execJS or Node.

We have a clear way to differentiate the Rails Env based webpack configs...

How do we do we configure a different config for a given entry?

Working on a PR that will allow overriding these options through env variable. Would that help?

How do we do we configure a different config for a given entry?

May be create a server.js webpack config file just for server rendering and use that internally. This file could either inherit from Webacker base config and override parts or you can create a fresh one that takes only one pack as entry - server_pack.js. Would that work?

May be create a server.js webpack config file just for server rendering and use that internally. This file could either inherit from Webacker base config and override parts or you can create a fresh one that takes only one pack as entry - server_pack.js. Would that work?

Like the other configs, this file could inherit the other files. I suppose that the file could use the ENV rather than having server.test.js, server.development.js, server.production.js.

What do we do about the webpacker.yml file? Are we going to write to the same or a different manifest?

The examples posted in #732 didn't use any other config apart from what is provided with Webpacker and server rendering works, except that one would need to turn off inline mode since that includes some boilerplate code that's DOM specific.

Even if one want to include several packs inside one bundle, you could require them all inside one pack like server_pack and render from that file. May be I am not very clear on use case, particularly how this is suppose to work in context of react-on-rails?

It could use same manifest I suppose. Why another manifest?