diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7c52b7966b1dc91334448b336ef8d0b0df29e5c1..3ac0515886f8624be6453d83b2b5907527ca07ee 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,19 +4,17 @@ stages:
   - install_dependencies
   - build_project
 
+cache:
+  key: "${CI_COMMIT_REF_SLUG}" # Branch-specific cache keys to have separate caches across branches.
+  paths:
+    - node_modules/
+
 install_dependencies:
   stage: install_dependencies
   script:
     - npm ci
-  artifacts:
-    paths:
-      - node_modules
 
 build_project:
   stage: build_project
   script:
     - npm run build
-  artifacts:
-    paths:
-      - node_modules/
-