catamphetamine / universal-webpack

Isomorphic Webpack: both on client and server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to skip waiting for webpack-chunks.json

phinoppix opened this issue · comments

Thanks for the hard work on this project, btw. Saved me a ton!

Q: Will it make sense to add an option that can disable waiting for webpack-chunks.json? Something like:

{
    nochunks: [true | false]
}

In my case, for an existing project, i needed to add server side rendering. Client settings require chunks, but server side does not. Still in progress, and I expect to work on this for a few days more.

My temporary workaround is to create the file as part of the build script.
But I think it will help on cases where the project is already existing.

Client settings require chunks, but server side does not.

Not understand. Server-side rendering does required chunks because it's has the URL to the javascript file unliess it's main.js which is lame and should be using hashes instead.

Basically SSR for this react project has a different webpack settings at the moment, where optimizations are disabled (ie chunks, uglify). Quite redundant on most parts, but consolidation of the settings will happen a bit later in my case. An option to temporarily disable the wait_for_file(chunks) would be a nice feature for those who start adopting universal-webpack on the server side first, client side later.

I see.
Well, this project is intended to be used as a Webpack configuration generator (client -> server) and running it the other way is not an intended behaviour.
Still no one is forcing a developer to call the server(config) function: a developer can do it by himself like

	import wait_for_file from './wait for file'

	// Path to `build/server.js`
	// (built by Webpack)
	const server_bundle_path = '...'
	
	// waits for the first Webpack server-side build to finish and produce `webpage_rendering_server.js`
	return wait_for_file(server_bundle_path).then(function()
	{
		require(server_bundle_path)()
	}