

- How to run webpack locally install#
- How to run webpack locally upgrade#
- How to run webpack locally code#
Simply transpiling the CoffeeScript files to JS with the coffee CLI, and then manually cleaning them up removed this dependency for us.
How to run webpack locally install#
Not to mention the benefit of reducing the npm install time, and reducing our dependency count! Compared with babel-loader taking an average of 561 ms, this was an obvious enough opportunity for improvement.

However, SMP revealed that coffee-loader was taking 1,078 ms on average for each module.
How to run webpack locally code#
This was never seen as that big a deal before, as the code was rarely touched, and the loader did its job fine.

We had some legacy code that was written in CoffeeScript. The time saved locally during a re-run is huge, but the initial (cold) run will actually be slower.Ĭaching on production builds that should be running from scratch each time anyway will just be slowing you down.

All of these caching methods have an overhead to boot up. There are a few ways to cache with webpack - like using cache-loader, HardSourceWebpackPlugin, or the ?cacheLoader babel flag. For local development, this is quite a lot of unnecessary work. The image-webpack-loader optimises these images, minifying and re-encoding them. Most webpack configs have a rule to handle images, and that rule is normally file-loader followed by image-webpack-loader, or some other similar image loader.īut the only necessary loader here is the file-loader, which actually allows the image to end up in the output directory, and its URI passed to the bundle. Remove Image Loaders for Local Development For us, running on i3.4xlarge EC2 instances with 16 vCPUs, this was considerable. Turning on the parallel flag, however, can save you a lot of time - depending on how beefy your machine is, and how many cores it has. If you’re only uglifying on a build server like Jenkins, then caching doesn’t really help you. Version 1 of the plugin introduces some performance features - namely parallelisation, and caching. However, there’s nothing stopping you from upgrading your UglifyJsPlugin version without upgrading webpack, and just manually importing the plugin instead. We were originally using webpack 3’s built-in UglifyJsPlugin which is set at version 0.4.6. For us it took 65% of the entire build time!
How to run webpack locally upgrade#
Upgrade and Parallelise UglifyJsPluginĮven a cursory glance at SMP’s output shows that UglifyJsPlugin takes a long time to run.
