Remix app fails when deploying - "A Netlify Function failed to require one of its dependencies"

I’m working on a Remix app which is using the following @uniswap/widgets React widget that has somewhere down in its dependency tree a hardhat dependency defined in the depedency field of a package.json.

The app works perfectly in local but it fails when deploying to Netlify at the time of bundling the lambda function due to the hardhat dependency missing.

The dependency is not necessary and even if a decide to add it to my app’s package.json it fails as the function exceeds the maximum limit throwing the following message:

The function "SERVER" is larger than the 50MB limit. Please consider reducing it.

Any ideas on how to solve this?. Would it be possible to tell Netlify lambda functions to ignore specific dependencies?

NETLIFY CONFIG FILE:

[build]
  command = "yarn build"
  publish = "public"

[dev]
  command = "remix watch"
  port = 3000

[[redirects]]
  from = "/*"
  to = "/.netlify/functions/server"
  status = 200

[[headers]]
  for = "/build/*"
  [headers.values]
    "Cache-Control" = "public, max-age=31536000, s-maxage=31536000"

BUILD LOG:

1:53:54 AM: Build ready to start
1:53:56 AM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
1:53:56 AM: build-image tag: v4.8.0
1:53:56 AM: buildbot version: 785511f5c344fb31afdecdfe3e45beb4c5bb14ae
1:53:56 AM: Fetching cached dependencies
1:54:00 AM: Finished downloading cache in 3.397903626s
1:54:00 AM: Starting to extract cache
1:54:11 AM: Finished extracting cache in 11.194981697s
1:54:11 AM: Finished fetching cache in 14.638715728s
1:54:11 AM: Starting to prepare the repo for build
1:54:11 AM: Preparing Git Reference refs/heads/swap-widget
1:54:11 AM: Parsing package.json dependencies
1:54:12 AM: Starting build script
1:54:13 AM: Installing dependencies
1:54:13 AM: Python version set to 2.7
1:54:13 AM: Started restoring cached node version
1:54:14 AM: Finished restoring cached node version
1:54:14 AM: v16.15.1 is already installed.
1:54:15 AM: Now using node v16.15.1 (npm v8.11.0)
1:54:15 AM: Started restoring cached build plugins
1:54:15 AM: Finished restoring cached build plugins
1:54:15 AM: Attempting ruby version 2.7.2, read from environment
1:54:16 AM: Using ruby version 2.7.2
1:54:16 AM: Using PHP version 8.0
1:54:16 AM: Started restoring cached yarn cache
1:54:21 AM: Finished restoring cached yarn cache
1:54:22 AM: No yarn workspaces detected
1:54:22 AM: Started restoring cached node modules
1:54:22 AM: Finished restoring cached node modules
1:54:22 AM: Installing NPM modules using Yarn version 1.22.10
1:54:22 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:54:22 AM: npm WARN config location in the cache, and they are managed by
1:54:22 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:54:22 AM: yarn install v1.22.10
1:54:22 AM: info No lockfile found.
1:54:22 AM: [1/5] Validating package.json...
1:54:22 AM: [2/5] Resolving packages...
1:54:23 AM: warning @blossom-labs/rosette-ui > popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
1:54:29 AM: warning @uniswap/widgets > cids@1.1.9: This module has been superseded by the multiformats module
1:54:29 AM: warning @uniswap/widgets > multicodec@3.2.1: This module has been superseded by the multiformats module
1:54:29 AM: warning @uniswap/widgets > cids > multicodec@3.2.1: This module has been superseded by the multiformats module
1:54:29 AM: warning @uniswap/widgets > popper-max-size-modifier@0.2.0: We recommend switching to Floating UI which supports this modifier out of the box: https://floating-ui.com/docs/size
1:54:30 AM: warning @uniswap/widgets > cids > multibase@4.0.6: This module has been superseded by the multiformats module
1:54:30 AM: warning @uniswap/widgets > multihashes > multibase@4.0.6: This module has been superseded by the multiformats module
1:54:31 AM: warning @uniswap/widgets > @uniswap/v3-sdk > @uniswap/v3-staker@1.0.0: Please upgrade to 1.0.1
1:54:32 AM: warning @uniswap/widgets > node-vibrant > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
1:54:34 AM: warning clipboard-polyfill@4.0.0-rc1: Use the browser-native async clipboard API instead of this library: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
1:54:37 AM: warning wagmi > walletlink@2.5.0: WARNING: This project has been renamed to @coinbase/wallet-sdk. Install using @coinbase/wallet-sdk instead.
1:54:37 AM: warning wagmi > @coinbase/wallet-sdk > eth-block-tracker > safe-event-emitter@1.0.1: Renamed to @metamask/safe-event-emitter
1:54:37 AM: warning wagmi > @coinbase/wallet-sdk > eth-json-rpc-filters > eth-json-rpc-middleware > safe-event-emitter@1.0.1: Renamed to @metamask/safe-event-emitter
1:54:37 AM: warning wagmi > @coinbase/wallet-sdk > eth-json-rpc-filters > eth-json-rpc-middleware > json-rpc-engine > safe-event-emitter@1.0.1: Renamed to @metamask/safe-event-emitter
1:54:38 AM: warning wagmi > @coinbase/wallet-sdk > eth-json-rpc-filters > eth-json-rpc-middleware > eth-sig-util@1.4.2: Deprecated in favor of '@metamask/eth-sig-util'
1:54:38 AM: warning wagmi > @walletconnect/ethereum-provider > @walletconnect/signer-connection > @walletconnect/qrcode-modal > @walletconnect/mobile-registry@1.4.0: Deprecated in favor of dynamic registry available from: https://github.com/walletconnect/walletconnect-registry
1:54:41 AM: warning @remix-run/dev > @esbuild-plugins/node-modules-polyfill > rollup-plugin-node-polyfills > rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
1:54:42 AM: warning @remix-run/dev > jscodeshift > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
1:54:42 AM: warning @remix-run/dev > jscodeshift > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
1:54:42 AM: warning @remix-run/dev > jscodeshift > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
1:54:42 AM: warning @remix-run/dev > jscodeshift > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
1:54:45 AM: [3/5] Fetching packages...
1:54:46 AM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
1:54:46 AM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-android-arm64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-android-arm64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-android-arm64@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info esbuild-darwin-64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-darwin-64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-freebsd-64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-freebsd-64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-freebsd-arm64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-freebsd-arm64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-freebsd-arm64@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info esbuild-linux-32@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info "esbuild-linux-32@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-linux-arm64@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info "esbuild-linux-arm64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-linux-arm@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info "esbuild-linux-arm@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-linux-riscv64@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info "esbuild-linux-riscv64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-netbsd-64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-netbsd-64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-sunos-64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-sunos-64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-windows-32@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-windows-32@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-windows-32@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info esbuild-windows-64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-windows-64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-windows-arm64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-windows-arm64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-windows-arm64@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info esbuild-linux-s390x@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info "esbuild-linux-s390x@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-darwin-arm64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-darwin-arm64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-darwin-arm64@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info esbuild-linux-ppc64le@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info "esbuild-linux-ppc64le@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-linux-mips64le@0.14.22: The CPU architecture "x64" is incompatible with this module.
1:54:46 AM: info "esbuild-linux-mips64le@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: info esbuild-openbsd-64@0.14.22: The platform "linux" is incompatible with this module.
1:54:46 AM: info "esbuild-openbsd-64@0.14.22" is an optional dependency and failed compatibility check. Excluding it from installation.
1:54:46 AM: [4/5] Linking dependencies...
1:54:46 AM: warning "@blossom-labs/rosette-ui > react-onclickout@2.0.8" has incorrect peer dependency "react@^15.x || ^16.x".
1:54:46 AM: warning "@blossom-labs/rosette-ui > react-onclickout@2.0.8" has incorrect peer dependency "react-dom@^15.x || ^16.x".
1:54:46 AM: warning "@blossom-labs/rosette-ui > use-inside@0.2.0" has incorrect peer dependency "react@^16.13.1".
1:54:46 AM: warning " > @uniswap/widgets@1.1.1" has unmet peer dependency "@babel/runtime@^7.17.0".
1:54:46 AM: warning "@uniswap/widgets > @uniswap/redux-multicall@1.1.1" has unmet peer dependency "@ethersproject/abi@5".
1:54:46 AM: warning "@uniswap/widgets > @uniswap/redux-multicall@1.1.1" has unmet peer dependency "@ethersproject/bignumber@5".
1:54:46 AM: warning "@uniswap/widgets > @uniswap/redux-multicall@1.1.1" has unmet peer dependency "@ethersproject/contracts@5".
1:54:46 AM: warning "@uniswap/widgets > @uniswap/redux-multicall@1.1.1" has incorrect peer dependency "react-redux@7".
1:54:46 AM: warning " > styled-components@5.3.5" has unmet peer dependency "react-is@>= 16.8.0".
1:54:46 AM: warning "@uniswap/widgets > rebass > reflexbox@4.0.6" has incorrect peer dependency "react@^16.8.6".
1:54:46 AM: warning "@uniswap/widgets > @uniswap/router-sdk > @uniswap/swap-router-contracts > hardhat-watcher@2.3.0" has unmet peer dependency "hardhat@^2.0.0".
1:54:46 AM: warning "wagmi > @coinbase/wallet-sdk > eth-block-tracker > @babel/plugin-transform-runtime@7.18.5" has unmet peer dependency "@babel/core@^7.0.0-0".
1:54:46 AM: warning "wagmi > @coinbase/wallet-sdk > eth-block-tracker > @babel/plugin-transform-runtime > babel-plugin-polyfill-corejs2 > @babel/helper-define-polyfill-provider@0.3.1" has unmet peer dependency "@babel/core@^7.4.0-0".
1:54:46 AM: warning Workspaces can only be enabled in private projects.
1:54:49 AM: [5/5] Building fresh packages...
1:54:51 AM: success Saved lockfile.
1:54:51 AM: $ npx patch-package && remix setup node
1:54:52 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:54:52 AM: npm WARN config location in the cache, and they are managed by
1:54:52 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:54:52 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:54:52 AM: npm WARN config location in the cache, and they are managed by
1:54:52 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:54:52 AM: patch-package 6.4.7
1:54:52 AM: Applying patches...
1:54:52 AM: @remix-run/dev@1.3.1 ✔
1:54:52 AM: Warning: patch-package detected a patch file version mismatch
1:54:52 AM:   Don't worry! This is probably fine. The patch was still applied
  successfully. Here's the deets:
1:54:52 AM:   Patch file created for
1:54:52 AM:     @remix-run/dev@1.3.1
1:54:52 AM:   applied to
1:54:52 AM:     @remix-run/dev@1.6.0
1:54:52 AM:   At path
1:54:52 AM:     node_modules/@remix-run/dev
1:54:52 AM:   This warning is just to give you a heads-up. There is a small chance of
1:54:52 AM:   breakage even though the patch was applied successfully. Make sure the package
1:54:52 AM:   still behaves like you expect (you wrote tests, right?) and then run
1:54:52 AM:     patch-package @remix-run/dev
1:54:52 AM:   to update the version in the patch file name and make this warning go away.
1:54:52 AM: ---
1:54:52 AM: patch-package finished with 1 warning(s).
1:54:53 AM: Missing the "remix" package. Please run `npm install remix` before `remix setup`.
1:54:53 AM: Successfully setup Remix for node.
1:54:53 AM: Done in 30.16s.
1:54:53 AM: NPM modules installed using Yarn
1:54:53 AM: Started restoring cached go cache
1:54:53 AM: Finished restoring cached go cache
1:54:53 AM: go version go1.16.5 linux/amd64
1:54:53 AM: go version go1.16.5 linux/amd64
1:54:53 AM: Installing missing commands
1:54:53 AM: Verify run directory
1:54:54 AM: ​
1:54:54 AM: ────────────────────────────────────────────────────────────────
1:54:54 AM:   Netlify Build                                                 
1:54:54 AM: ────────────────────────────────────────────────────────────────
1:54:54 AM: ​
1:54:54 AM: ❯ Version
1:54:54 AM:   @netlify/build 27.1.5
1:54:54 AM: ​
1:54:54 AM: ❯ Flags
1:54:54 AM:   baseRelDir: true
1:54:54 AM:   buildId: 62aa7112e1b3070008cbe9bf
1:54:54 AM:   deployId: 62aa7112e1b3070008cbe9c1
1:54:54 AM: ​
1:54:54 AM: ❯ Current directory
1:54:54 AM:   /opt/build/repo
1:54:54 AM: ​
1:54:54 AM: ❯ Config file
1:54:54 AM:   /opt/build/repo/netlify.toml
1:54:54 AM: ​
1:54:54 AM: ❯ Context
1:54:54 AM:   branch-deploy
1:54:54 AM: ​
1:54:54 AM: ────────────────────────────────────────────────────────────────
1:54:54 AM:   1. build.command from netlify.toml                            
1:54:54 AM: ────────────────────────────────────────────────────────────────
1:54:54 AM: ​
1:54:54 AM: $ yarn build
1:54:54 AM: yarn run v1.22.10
1:54:54 AM: $ yarn sync-assets && cross-env NODE_ENV=production remix build
1:54:55 AM: $ copy-aragon-ui-assets ./public
1:54:55 AM: aragonUI assets copied to public/aragon-ui
1:54:56 AM: Building Remix app in production mode...
1:54:58 AM: Built in 2.2s
1:54:58 AM: Done in 3.60s.
1:54:58 AM: ​
1:54:58 AM: (build.command completed in 3.8s)
1:54:58 AM: ​
1:54:58 AM: ────────────────────────────────────────────────────────────────
1:54:58 AM:   2. Functions bundling                                         
1:54:58 AM: ────────────────────────────────────────────────────────────────
1:54:58 AM: ​
1:54:58 AM: Packaging Functions from .netlify/functions-internal directory:
1:54:58 AM:  - server.js
1:54:58 AM: ​
1:55:01 AM: ​
1:55:01 AM: ────────────────────────────────────────────────────────────────
1:55:01 AM:   Dependencies installation error                               
1:55:01 AM: ────────────────────────────────────────────────────────────────
1:55:01 AM: ​
1:55:01 AM:   Error message
1:55:01 AM:   A Netlify Function failed to require one of its dependencies.
1:55:01 AM:   Please make sure it is present in the site's top-level "package.json".
​
1:55:01 AM:   In file "/opt/build/repo/.netlify/functions-internal/server.js"
1:55:01 AM:   Cannot find module 'hardhat'
1:55:01 AM:   Require stack:
1:55:01 AM:   - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js
1:55:01 AM: ​
1:55:01 AM:   Resolved config
1:55:01 AM:   build:
1:55:01 AM:     command: yarn build
1:55:01 AM:     commandOrigin: config
1:55:01 AM:     environment:
1:55:01 AM:       - AWS_LAMBDA_JS_RUNTIME
1:55:01 AM:       - CHAIN_ID
1:55:01 AM:       - ETHERSCAN_EXPLORER_API_KEY
1:55:01 AM:       - INFURA_IPFS_API_KEY
1:55:01 AM:       - INFURA_PROJECT_ID
1:55:01 AM:       - NETLIFY_USE_YARN
1:55:01 AM:       - POLYGONSCAN_EXPLORER_API_KEY
1:55:01 AM:       - ROSETTE_STONE_ADDRESS
1:55:01 AM:       - RPC_URL
1:55:01 AM:       - SUBGRAPH_URI
1:55:01 AM:     publish: /opt/build/repo/public
1:55:01 AM:     publishOrigin: config
1:55:01 AM:   headers:
1:55:02 AM:     - for: /build/*
      values:
        Cache-Control: public, max-age=31536000, s-maxage=31536000
  headersOrigin: config
  redirects:
    - from: /*
      status: 200
      to: /.netlify/functions/server
  redirectsOrigin: config
Caching artifacts
1:55:02 AM: Started saving node modules
1:55:02 AM: Finished saving node modules
1:55:02 AM: Started saving build plugins
1:55:02 AM: Finished saving build plugins
1:55:02 AM: Started saving yarn cache
1:55:07 AM: Finished saving yarn cache
1:55:07 AM: Started saving pip cache
1:55:07 AM: Finished saving pip cache
1:55:07 AM: Started saving emacs cask dependencies
1:55:07 AM: Finished saving emacs cask dependencies
1:55:07 AM: Started saving maven dependencies
1:55:07 AM: Finished saving maven dependencies
1:55:07 AM: Creating deploy upload records
1:55:07 AM: Started saving boot dependencies
1:55:07 AM: Finished saving boot dependencies
1:55:07 AM: Started saving rust rustup cache
1:55:07 AM: Finished saving rust rustup cache
1:55:07 AM: Started saving go dependencies
1:55:07 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:55:07 AM: Finished saving go dependencies
1:55:07 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:55:07 AM: Failing build: Failed to build site
1:55:07 AM: Finished processing build request in 1m11.04555812s

MISSING DEPENDENCIES TREE

├─┬ @remix-run/dev
│ └─┬ jscodeshift
│   └── ✕ missing peer @babel/preset-env@^7.1.6
├─┬ @uniswap/widgets
│ ├─┬ @uniswap/redux-multicall
│ │ ├── ✕ missing peer @ethersproject/abi@5
│ │ ├── ✕ missing peer @ethersproject/bignumber@5
│ │ ├── ✕ missing peer @ethersproject/contracts@5
│ │ └── ✕ unmet peer react-redux@7: found 8.0.2
│ ├─┬ @uniswap/router-sdk
│ │ └─┬ @uniswap/swap-router-contracts
│ │   └─┬ @uniswap/v3-periphery
│ │     └─┬ hardhat-watcher
│ │       └── ✕ missing peer hardhat@^2.0.0
│ ├─┬ jotai
│ │ └── ✕ missing peer @babel/core@"*"
│ ├─┬ styled-components
│ │ └── ✕ missing peer react-is@">= 16.8.0"
│ └─┬ rebass
│   ├── ✕ unmet peer react@^16.8.6: found 17.0.2
│   └─┬ reflexbox
│     └── ✕ unmet peer react@^16.8.6: found 17.0.2
├─┬ wagmi
│ └─┬ @coinbase/wallet-sdk
│   └─┬ eth-block-tracker
│     └─┬ @babel/plugin-transform-runtime
│       ├── ✕ missing peer @babel/core@^7.0.0-0
│       ├─┬ babel-plugin-polyfill-corejs2
│       │ ├── ✕ missing peer @babel/core@^7.0.0-0
│       │ └─┬ @babel/helper-define-polyfill-provider
│       │   ├── ✕ missing peer @babel/core@^7.4.0-0
│       │   └─┬ @babel/helper-compilation-targets
│       │     └── ✕ missing peer @babel/core@^7.0.0
│       ├─┬ babel-plugin-polyfill-corejs3
│       │ └── ✕ missing peer @babel/core@^7.0.0-0
│       └─┬ babel-plugin-polyfill-regenerator
│         └── ✕ missing peer @babel/core@^7.0.0-0
├─┬ ipfs-http-client
│ └─┬ ipfs-core-types
│   └─┬ multiaddr
│     └─┬ dns-over-http-resolver
│       └─┬ native-fetch
│         └── ✕ missing peer node-fetch@"*"
└─┬ @blossom-labs/rosette-ui
  ├─┬ react-onclickout
  │ ├── ✕ unmet peer react@"^15.x || ^16.x": found 17.0.2
  │ └── ✕ unmet peer react-dom@"^15.x || ^16.x": found 17.0.2
  └─┬ use-inside
    └── ✕ unmet peer react@^16.13.1: found 17.0.2

Could you try to add that dependency and then exclude it from bundling by using included_files:

as explained here: