Skip to content

Commit

Permalink
add sample code and polyfills
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Aug 30, 2024
1 parent 386599a commit 311e65f
Show file tree
Hide file tree
Showing 6 changed files with 633 additions and 9 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Description

This project is a sample React app using [create-react-app](https://github.com/facebook/create-react-app) and [monero-ts](https://github.com/woodser/monero-ts).

## How to Run in a Browser

1. `git clone https://github.com/woodser/xmr-sample-react.git`
2. `cd xmr-sample-react`
3. `npm install`
4. `npm start`
5. Access [http://localhost:3000](http://localhost:3000) in a browser.
6. See the XMR output in the server console.

# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Expand Down
40 changes: 40 additions & 0 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const webpack = require("webpack");

module.exports = function override(config) {
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
crypto: false, // require.resolve("crypto-browserify") can be polyfilled here if needed
stream: require.resolve("stream-browserify"), // require.resolve("stream-browserify") can be polyfilled here if needed
assert: require.resolve("assert"), // require.resolve("assert") can be polyfilled here if needed
http: require.resolve("stream-http"), // require.resolve("stream-http") can be polyfilled here if needed
https: require.resolve("https-browserify"), // require.resolve("https-browserify") can be polyfilled here if needed
os: false, // require.resolve("os-browserify") can be polyfilled here if needed
url: false, // require.resolve("url") can be polyfilled here if needed
zlib: false, // require.resolve("browserify-zlib") can be polyfilled here if needed,
});
config.resolve.fallback = fallback;
config.resolve.alias = {
...config.resolve.alias,
fs: "memfs",
};
config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: "process/browser",
Buffer: ["buffer", "Buffer"],
}),
]);
config.ignoreWarnings = [/Failed to parse source map/];
config.module.rules.push({
test: /\.(js|mjs|jsx)$/,
enforce: "pre",
loader: require.resolve("source-map-loader"),
resolve: {
fullySpecified: false,
},
});
config.externals = {
...config.externals,
child_process: 'child_process'
};
return config;
};
Loading

0 comments on commit 311e65f

Please sign in to comment.