From 2681282af54c2f87d20165af588433823e7ea31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Kochen?= Date: Sat, 29 Aug 2020 10:55:21 +0200 Subject: [PATCH] Fix build on Node.js 10 --- .github/workflows/build.yml | 3 ++- build.js | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f9b40f..0fd5249 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,8 @@ jobs: with: node-version: 10.x - - uses: actions/cache@v2 + - name: Yarn cache + uses: actions/cache@v2 with: path: .yarn/cache key: yarn-${{ hashFiles('yarn.lock') }} diff --git a/build.js b/build.js index 1f1c899..f0b9e65 100755 --- a/build.js +++ b/build.js @@ -38,9 +38,13 @@ const compiler = webpack({ extensions: [`.mjs`, `.js`, `.ts`, `.tsx`, `.json`], }, - externals: Object.fromEntries( - EXTERNALS.map((name) => [name, `commonjs ${name}`]) - ), + externals: (() => { + const res = {}; + for (const name of EXTERNALS) { + res[name] = `commonjs ${name}`; + } + return res; + })(), module: { rules: [