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

How to use webpack in server #728

Closed
thepian opened this Issue Jan 27, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@thepian

thepian commented Jan 27, 2015

I'm making a webpack plugin for the Socketstream server. It is run with one or more client view definitions. For each a single JS bundle is created. At dev time they are kept up-to-date and served from memory. In production they are saved to disk.

Should I make one webpack instance per client, or a single common one?

I had the idea that I could create a webpack compiler instance without an entry point specified and with a MemoryFileSystem as the output fs, and then call compiler.run each time I need to generate a client view JS bundle to serve. I do not see any way to specify the entry point when calling compiler.run, so I assume this is not a supported use case.

@jhnns

This comment has been minimized.

Member

jhnns commented Jan 28, 2015

If both clients are completely separate, you should separate the webpack bundles too. If both contain common modules and the user is likely to switch from one to the other, it would make sense to use a common webpack bundle to benefit from caching.

@thepian

This comment has been minimized.

thepian commented Jan 31, 2015

Is there a good example of how to output to an in-memory buffer? I've tried to emulate how other projects have done it, but I seem to get path errors rather than results.

@sokra

This comment has been minimized.

Member

sokra commented Feb 1, 2015

The webpack-dev-middleware does this: https://github.com/webpack/webpack-dev-middleware/blob/master/middleware.js#L18

  • set outputFileSystem to a memory-fs instance
  • set options.output.path to "/"

@bebraw bebraw added the question label Nov 15, 2015

@bebraw

This comment has been minimized.

Member

bebraw commented Nov 15, 2015

@thepian Did you figure this out?

@thepian

This comment has been minimized.

thepian commented Nov 19, 2015

Not as I recall, I tried what sokra suggested and it didn't work for me.

https://github.com/thepian/ss-build/blob/master/lib/webpack/index.js

@bebraw

This comment has been minimized.

Member

bebraw commented Apr 24, 2016

@thepian Any update?

@bebraw bebraw closed this Aug 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment