Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a different webpack config based on the entry name #842

Closed
justin808 opened this issue Sep 20, 2017 · 3 comments
Closed

Need a different webpack config based on the entry name #842

justin808 opened this issue Sep 20, 2017 · 3 comments

Comments

@justin808
Copy link
Contributor

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?

@gauravtiwari
Copy link
Member

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?

@justin808
Copy link
Contributor Author

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?

@gauravtiwari
Copy link
Member

gauravtiwari commented Sep 25, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants