diff --git a/apps/remix-ide/webpack.config.js b/apps/remix-ide/webpack.config.js index 5b3d7d56c1..da42ed0c74 100644 --- a/apps/remix-ide/webpack.config.js +++ b/apps/remix-ide/webpack.config.js @@ -7,6 +7,7 @@ const fs = require('fs') const TerserPlugin = require('terser-webpack-plugin') const CssMinimizerPlugin = require('css-minimizer-webpack-plugin') const rustbnWasm = require('rustbn-wasm') +const path = require('path') const versionData = { version: version, @@ -68,15 +69,13 @@ module.exports = composePlugins(withNx(), withReact(), (config) => { readline: false, child_process: false, buffer: require.resolve('buffer/'), - vm: require.resolve('vm-browserify'), - 'rustbn-wasm': require.resolve('rustbn-wasm') + vm: require.resolve('vm-browserify') } // add externals config.externals = { ...config.externals, solc: 'solc', - 'rustbn-wasm': rustbnWasm } // uncomment this to enable react profiling @@ -87,6 +86,17 @@ module.exports = composePlugins(withNx(), withReact(), (config) => { } */ + // use the web build instead of the node.js build + // we do like that because using "config.resolve.alias" doesn't work + let pkgVerkle = fs.readFileSync(path.resolve(__dirname, '../../node_modules/rust-verkle-wasm/package.json'), 'utf8') + pkgVerkle = pkgVerkle.replace('"main": "./nodejs/rust_verkle_wasm.js",', '"main": "./web/rust_verkle_wasm.js",') + fs.writeFileSync(path.resolve(__dirname, '../../node_modules/rust-verkle-wasm/package.json'), pkgVerkle) + + config.resolve.alias = { + ...config.resolve.alias, + // 'rust-verkle-wasm$': path.resolve(__dirname, '../../node_modules/rust-verkle-wasm/web/run_verkle_wasm.js') + } + // add public path if(process.env.NX_DESKTOP_FROM_DIST){ diff --git a/package.json b/package.json index 5de2bfb796..d32748ffce 100644 --- a/package.json +++ b/package.json @@ -230,7 +230,7 @@ "remark-gfm": "^3.0.1", "rlp": "^3.0.0", "rss-parser": "^3.12.0", - "rustbn-wasm": "^0.2.0", + "rustbn-wasm": "^0.4.0", "signale": "^1.4.0", "snarkjs": "^0.7.0", "sol2uml": "^2.4.3", diff --git a/yarn.lock b/yarn.lock index a452a41603..cdc27a963c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5533,7 +5533,7 @@ estree-walker "^2.0.1" picomatch "^2.2.2" -"@scure/base@^1.1.1", "@scure/base@^1.1.3", "@scure/base@^1.1.5", "@scure/base@~1.1.4": +"@scure/base@^1.1.3", "@scure/base@^1.1.5", "@scure/base@~1.1.4": version "1.1.5" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.5.tgz#1d85d17269fe97694b9c592552dd9e5e33552157" integrity sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ== @@ -25950,13 +25950,6 @@ rust-verkle-wasm@^0.0.1: resolved "https://registry.yarnpkg.com/rust-verkle-wasm/-/rust-verkle-wasm-0.0.1.tgz#fd8396a7060d8ee8ea10da50ab6e862948095a74" integrity sha512-BN6fiTsxcd2dCECz/cHtGTt9cdLJR925nh7iAuRcj8ymKw7OOaPmCneQZ7JePOJ/ia27TjEL91VdOi88Yf+mcA== -rustbn-wasm@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/rustbn-wasm/-/rustbn-wasm-0.2.0.tgz#0407521fb55ae69eeb4968d01885d63efd1c4ff9" - integrity sha512-FThvYFNTqrEKGqXuseeg0zR7yROh/6U1617mCHF68OVqrN1tNKRN7Tdwy4WayPVsCmmK+eMxtIZX1qL6JxTkMg== - dependencies: - "@scure/base" "^1.1.1" - rustbn-wasm@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/rustbn-wasm/-/rustbn-wasm-0.4.0.tgz#fe5601c8d795dd9aa91c19cfad9637ec1df941b0"