// Rust expects modules to be bundled already. This is just the config for webpack to bundle everything // into a format that works as a dynamic library for WASM. // // experiments.outputModule // https://webpack.js.org/configuration/experiments/ // // // https://github.com/web-infra-dev/rspack/issues/2293 // https://github.com/webpack/webpack/issues/2933 const path = require('path'); const webpack = require('webpack'); module.exports = { entry: './index.js', mode: 'production', output: { path: path.resolve(__dirname, './../pkg/bundles/web3_bindings'), filename: 'web3_bindings.bundle.js', // ESM format library: { type: 'module', }, }, // This maintains the names of the exports (These are the names rust uses) optimization: { mangleExports: false, }, experiments: { outputModule: true, }, plugins: [ // To easily include it in the WASM binary, this limits the bundle to 1 file new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1, }), ], };