React library peer dependency conflict

I’m creating a small library to power a few of my projects.

I found that i was getting issues inside the client apps with multiple conflicting versions of react when importing my library. This led me to setting both react and react-dom under peer dependencies in the library package.json which fixed the problem.

However, I am trying to run a sandbox environment via a webpack bundler to test and play with components within the library repo as i am working on it (instead of using npm link), and now I am having an issue whereby react is no longer being detected as a local dependency.

Here is my webpack config.
FWIW, when building out the components for production use I am exporting modules via tsconfig, and not using webpack at all. But i’m finding it difficult to resolve this situation of maintaining a test environment :/

const path = require('path');
const webpack = require('webpack');
const HtmlWebPackPlugin = require('html-webpack-plugin');

const isDevelopment = process.env.NODE_ENV !== 'production';

module.exports = {
  mode: isDevelopment ? 'development' : 'production',
  entry: path.resolve(__dirname, './sandbox/web/index.tsx'),
  module: {
    rules: [
      {
        test: /.tsx?$/,
        exclude: /node_modules/,
        use: ['babel-loader', 'ts-loader'],
      },
      {
        test: /.(s(a|c)ss)$/,
        use: ['style-loader', 'css-loader', 'sass-loader'],
      },
      {
        test: /.svg?$/,
        loader: 'svg-url-loader',
        options: {
          limit: 10000,
        },
      },
    ],
  },
  resolve: {
    extensions: ['.js', '.jsx', '.tsx', '.ts'],
    alias: {
      src: path.resolve(__dirname, 'src'),
      components: path.resolve(__dirname, 'src/components'),
      hooks: path.resolve(__dirname, 'src/hooks'),
      themes: path.resolve(__dirname, 'src/themes'),
      types: path.resolve(__dirname, 'src/types'),
      utils: path.resolve(__dirname, 'src/utils'),
      'react-native$': 'react-native-web',
    },
  },
  output: {
    path: path.resolve(__dirname, './sandbox/web'),
    filename: 'bundle.js',
  },
  devtool: 'inline-source-map',
  watchOptions: {
    poll: true,
    ignored: '/node_modules/',
  },
  plugins: [
    new HtmlWebPackPlugin({
      template: path.resolve(__dirname, './sandbox/web/index.html'),
      filename: 'index.html',
    }),
    new webpack.IgnorePlugin({
      resourceRegExp: /^./native$/,
      contextRegExp: /src$/,
    }),
  ],
  devServer: {
    historyApiFallback: {
      index: '/',
    },
  },
};