From e077f285d00434b801da7a744d7b42d034036f09 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Tue, 25 May 2021 11:33:30 +0100 Subject: [PATCH] fix: remove optional chaining from code that will be transpiled Optional chaining is supported in node and in browsers but tools that transpile code to run in older browsers doesn't understand the syntax. Specifically the version of acorn that at least vue uses via a dependency on webpack 4 does not support this. It'll be fixed by them upgrading to webpack 5 but the timescale on that is unclear, which is why we're using a prerelease version in our examples. The short term fix is to just remove optional chaining from where we are using it in code that will be transpiled for browser use. --- packages/ipfs-core/src/components/add-all/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ipfs-core/src/components/add-all/index.js b/packages/ipfs-core/src/components/add-all/index.js index 5d14f5685d..2eb11547cc 100644 --- a/packages/ipfs-core/src/components/add-all/index.js +++ b/packages/ipfs-core/src/components/add-all/index.js @@ -189,7 +189,7 @@ function pinFile (pin, opts) { for await (const file of source) { // Pin a file if it is the root dir of a recursive add or the single file // of a direct add. - const isRootDir = !file.path?.includes('/') + const isRootDir = !(file.path && file.path.includes('/')) const shouldPin = (opts.pin == null ? true : opts.pin) && isRootDir && !opts.onlyHash if (shouldPin) {