Skip to content

Commit 7115c24

Browse files
authored
Webpack: use filesystem cache for compilation (#643)
This allows to speed up webpack start. It went from 8s to 1s in my laptop after the initial compilation. By default, webpack uses memory cache, but it's deleted once the container is shut down. Keeping the cache in the filesystem allows the container to reuse the cached resources.
1 parent 8cebb92 commit 7115c24

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

webpack.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ export default (env, argv) => {
5555
},
5656
},
5757
},
58+
59+
// Use filesystem for cache instead memory (default) to be re-use the cache
60+
// between Docker container starts/stops. This speeds up boot time a lot.
61+
cache: {
62+
type: is_production ? "memory" : "filesystem",
63+
},
64+
5865
module: {
5966
rules: [
6067
{

0 commit comments

Comments
 (0)