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

speeding up WebPack builds by adding hard-source-webpack-plugin #914

Closed
wants to merge 1 commit into from

Conversation

EvanLovely
Copy link
Contributor

I came across the hard-source-webpack-plugin and saw fantastic speed results with zero config, so I knew Bolt needed to have it! Just dropped it in and saw Bolt's WebPack compile step in PL go from 51.9s => 5.4s!! It's all about caching, so you'll only see it on subsequent compiles. Also: I have not tested; didn't crack open PL or anything, so please take a look. A 10x speed increase is pretty incredible; I really hope that this "just works" for you!

…ebpack-plugin

Creates a cache, so speed increases is only seen after subsequent compiles.
@EvanLovely EvanLovely requested a review from sghoweri October 15, 2018 21:35
@bolt-bot
Copy link
Collaborator

⚡ PR built on Travis and deployed a now preview here:

@sghoweri
Copy link
Contributor

@EvanLovely nice!!

I know I’ve tested this plugin out a couple times with somewhat mixed results... I’d be super curious about what the recompile times are like when re-saving any Sass in @bolt/core or @bolt/global.

Here’s hoping! 🤞

@sghoweri
Copy link
Contributor

@EvanLovely so with some updates I had to figure out locally (Webpack recompile issues related to webpack/webpack#8052) - I was able to get this working with some really awesome results!

Initial Webpack compile time via npm start: 43.920 seconds
After stopping the build and re-running npm start... 4.543 seconds! 🎉

@EvanLovely
Copy link
Contributor Author

What did you need to do to get it working?

@sghoweri
Copy link
Contributor

sghoweri commented Oct 17, 2018

@EvanLovely the initial build seems to always be fine... the problems seem to be from subsequent file changes and/or restarting the build with the cache is getting used.

I initially had to change the webpack version to 4.19.0 to get around a JS error that started popping up -- then I ran into a separate issue involving mzgoddard/hard-source-webpack-plugin#416 which led me to scalableminds/webknossos#3239

image

So far so good now... but I'm holding off merging this in till I'm positive there aren't any more weird bugs that pop up locally.

@sghoweri
Copy link
Contributor

Unfortunately I’ve come across two additional HardSourcePlugin-related corrupted cache errors while running this plugin locally (working on some separate Webpack Dev Server updates) ☹️

23feaeb6-a2e8-40e5-8520-2212b4e5db96

f14624d4-5b27-49d5-9fda-76ec1593a339

Copy link
Contributor

@sghoweri sghoweri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the idea @EvanLovely but closing this out in lieu of #923 so we have this added via a feature toggle. This'll help a ton with local front-end builds!

@sghoweri sghoweri closed this Oct 19, 2018
@sghoweri sghoweri deleted the feature/webpack-speed branch October 19, 2018 19:46
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

Successfully merging this pull request may close these issues.

3 participants