support cache like babel-loader

1
closed
imcuttle
imcuttle
Posted 6 months ago

support cache like babel-loader #224

Feature request

esbuild-loader and ESBuildMinifyPlugin supports cache feature for better speed

Why?

babel-loader and terser-webpack-plugin have options of cacheDirectory, And in my screen

babel-loader + ESBuildMinifyPlugin
  - build
        time      cpu 
	125s     259%
	103s     213%  (with cache)
	101s     203%  (with cache)
esbuild-loader + ESBuildMinifyPlugin
  - build
	94s     248% 
	104s    204%

terser-webpack-plugin + esbuild-loader
  - build
	184s    268%
	89s     236%  (with cache)
	93s    234%  (with cache)

ESBuildMinifyPlugin + esbuild-loader
  - build
	94s     225% 
	93s    222%

babel-loader with cache reduces the 20% time, and terser-webpack-plugin reduces the 50%. and it may works for esbuild-loader and ESBuildMinifyPlugin

Alternatives

No response

Additional context

No response

privatenumber
privatenumber
Created 6 months ago

If you're using Webpack 5, you can use file-system caching. If not, you can use the deprecated cache-loader.

I don't think there's any value in adding it to the loader considering Webpack now offers an official caching solution.