From 2ee320b520d50c60f945e1eb5489b716ae8a7103 Mon Sep 17 00:00:00 2001 From: Angela Gilhotra Date: Thu, 2 Jan 2025 16:23:57 -0800 Subject: [PATCH] deps fix --- apps/demo-app/next.config.js | 37 ++++++++++++++++++++++++++++++++++++ apps/demo-app/package.json | 9 ++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/apps/demo-app/next.config.js b/apps/demo-app/next.config.js index da1bb770..c3c69973 100644 --- a/apps/demo-app/next.config.js +++ b/apps/demo-app/next.config.js @@ -1,3 +1,40 @@ +/** @type {import('next').NextConfig} */ +const webpack = require("webpack"); + module.exports = { reactStrictMode: true, + transpilePackages: [ + "@burnt-labs/abstraxion", + "@burnt-labs/abstraxion-core", + "@burnt-labs/signers", + "@keplr-wallet/crypto", + "tough-cookie", + "fetch-cookie", + "starknet", + ], + webpack: (config, { isServer }) => { + if (!isServer) { + // Polyfill node: protocol imports + config.plugins.push( + new webpack.NormalModuleReplacementPlugin(/^node:/, (resource) => { + resource.request = resource.request.replace(/^node:/, ""); + }), + ); + + config.resolve = { + ...config.resolve, + fallback: { + ...config.resolve.fallback, + url: require.resolve("url/"), + crypto: require.resolve("crypto-browserify"), + stream: require.resolve("stream-browserify"), + buffer: require.resolve("buffer/"), + util: require.resolve("util/"), + http: require.resolve("stream-http"), + https: require.resolve("https-browserify"), + }, + }; + } + return config; + }, }; diff --git a/apps/demo-app/package.json b/apps/demo-app/package.json index 72472d01..8f67497e 100644 --- a/apps/demo-app/package.json +++ b/apps/demo-app/package.json @@ -32,9 +32,16 @@ "@types/react": "^18.2.47", "@types/react-dom": "^18.2.18", "autoprefixer": "^10.4.13", + "buffer": "^6.0.3", + "crypto-browserify": "^3.12.1", "eslint-config-next": "14.0.4", + "https-browserify": "^1.0.0", "postcss": "^8.4.20", + "stream-browserify": "^3.0.0", + "stream-http": "^3.2.0", "tailwindcss": "^3.2.4", - "typescript": "^5.2.2" + "typescript": "^5.2.2", + "url": "^0.11.4", + "util": "^0.12.5" } }