Skip to content

Commit

Permalink
fix: webpack 4 build error (#707)
Browse files Browse the repository at this point in the history
Fixes #581
This pr reworks the problematic error message to not use the coalesce operator to resolve webpack4 issues.
In the future might look at the current rollup config and transpile to es5 or another valid syntax and export for older build setups. This however is a quick and easy solution for this specific build issue.

I verified this by creating a webpack 4 config and found the issue and resolved locally. This isn't the most foolproof way, but whenever I fixed it this way, create-react-app using webpack 4 successfully compiled, and angular 13 does not have this issue, it used webpack 5 now.
  • Loading branch information
dashcraft authored Nov 29, 2021
1 parent f3ccded commit 2c658a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/client/src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class Web3Storage {
if (!res.ok) {
/* c8 ignore next 2 */
const errorMessage = await res.json()
throw new Error(`${res.status} ${res.statusText} ${'- ' + errorMessage?.message || ''}`)
throw new Error(`${res.status} ${res.statusText} ${errorMessage ? '- ' + errorMessage.message : ''}`)
}
const page = await res.json()
for (const upload of page) {
Expand Down

0 comments on commit 2c658a1

Please sign in to comment.