Skip to content

Possible Build Optimizations #249

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

Open
weaverryan opened this issue Jan 25, 2018 · 7 comments
Open

Possible Build Optimizations #249

weaverryan opened this issue Jan 25, 2018 · 7 comments

Comments

@weaverryan
Copy link
Member

Totally just dropping this here until I have some more time to look at it, but Slack had a nice summary of build optimizations: https://slack.engineering/keep-webpack-fast-a-field-guide-for-better-build-performance-f56a5995e8f1

It may be possible that we can package some of these automatically for users :)

@Lyrkan
Copy link
Collaborator

Lyrkan commented Jan 26, 2018

Hey Ryan,

Maybe we should wait for Webpack 4 (see #250) before starting to work on that, they seem to have included some of the optimizations described in this post in their default settings (such as the UglifyJS parallelization).

Also, some related issues:

@weaverryan
Copy link
Member Author

I think that's probably wise :)

@seyfer
Copy link

seyfer commented Jan 14, 2019

Have somebody tried https://github.com/webpack-contrib/thread-loader?

I do not even know how to add it to babel loaders list. It is not in the options.

@seyfer
Copy link

seyfer commented Jan 14, 2019

I also do not understand how to try https://github.com/trivago/parallel-webpack with Encore.
Seems like currently, Encore run configs in parallel on a single CPU. Am I right?
But parallel-webpack uses node workers farm and runs on N cores in parallel.

@claytron5000
Copy link

claytron5000 commented Nov 9, 2020

Have somebody tried https://github.com/webpack-contrib/thread-loader?

I do not even know how to add it to babel loaders list. It is not in the options.

This is a hariy hack, but this got it working for typescript files. Better yet would be to request a feature to allow pre-pending loaders.

const pack = Encore.getWebpackConfig();


pack.module.rules.forEach(rule => {
	
	if (rule.test.test('.ts')) {
		
		// this could be configured above, but this way all the threading config is in one place.
		rule.use.forEach(loader => {
			if (loader.loader === 'ts-loader') {
				loader.options.happyPackMode = true;
			}
		})
		rule.use.unshift({loader: 'thread-loader', options: {
			workers: 2
		}})
	}
})

I made a feature request to allow pre-pending loaders: #852
NOTE: this is unrelated to this issue thread.

@claytron5000
Copy link

I want to second supporting Dllplugin.

@carsonbot
Copy link
Collaborator

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

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

5 participants