Close Menu
  • Home
  • Altcoin
  • Bitcoin
  • Crypto
  • Forex
  • Online Money
What's Hot

Coinbase Expands USDC Loans to UK After Strong US Demand – Bitcoin News

April 20, 2026

🚀 GRABBER BOT — no more missed trades – My Trading – 20 April 2026

April 20, 2026

The Market’s Compass Emerging Markets Country ETF Study

April 20, 2026
Facebook X (Twitter) Instagram
  • Altcoin
  • Bitcoin
  • Crypto
  • Forex
  • Online Money
Facebook X (Twitter) Instagram
Cointelegraphe
  • Home
  • Altcoin
  • Bitcoin
  • Crypto
  • Forex
  • Online Money
Cointelegraphe
Home»Bitcoin»Webpack issue with tiny-secp256k1 and ECPair
Webpack issue with tiny-secp256k1 and ECPair
Bitcoin

Webpack issue with tiny-secp256k1 and ECPair

adminBy adminJuly 9, 2025No Comments2 Mins Read
Share
Facebook Twitter LinkedIn Pinterest Email


I am developing a browser extension using Webpack v5 and incorporating the bitcoinjs-lib and ecpair libraries to create a Bitcoin wallet. However, I am encountering an error when attempting to load the WebAssembly module.

I would greatly appreciate any guidance or suggestions on how to resolve this issue successfully and instantiate the WebAssembly module in my browser extension.

Error Message:

Webpack issue with tiny-secp256k1 and ECPair

Here are the key details of my setup:

  • I am using Webpack v5 to bundle the application.
  • I have included the bitcoinjs-lib and ecpair libraries as dependencies in my project.
  • Error is occurring when trying to import tiny-secp256k1 and also when passing that instance to ECPairFactory.

enter image description here

My webpack.config.js file:

const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { exec } = require("child_process");
const fs = require("fs");

function copyFolderSync(from, to) {
  fs.mkdirSync(to, { recursive: true });
  fs.readdirSync(from).forEach((element) => {
    if (element !== "manifest.json") {
      if (fs.lstatSync(path.join(from, element)).isFile()) {
        fs.copyFileSync(path.join(from, element), path.join(to, element));
      } else {
        copyFolderSync(path.join(from, element), path.join(to, element));
      }
    }
  });
}

module.exports = {
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: ["style-loader", "css-loader", "sass-loader"],
      },
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env", "@babel/preset-react"],
          },
        },
      },
      {
        test: /\.wasm$/,
        type: "webassembly/async", // or "webassembly/sync"
      },
    ],
  },
  experiments: {
    asyncWebAssembly: true,
  },
  resolve: {
    extensions: [".js", ".jsx"],
    fallback: {
      buffer: require.resolve("buffer"),
      stream: require.resolve("stream-browserify"),
    },
  },
  entry: {
    background: "./app/background.js",
    popup: "./app/popup.js",
  },
  output: {
    path: path.resolve(__dirname, "dist/chrome"),
    filename: "[name].js",
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: "./app/popup.html",
      filename: "popup.html",
      chunks: ["popup"],
    }),
    new CopyPlugin({
      patterns: [
        {
          from: "app",
          to: "",
          globOptions: {
            ignore: [
              "**/background.js",
              "**/popup.js",
              "**/popup.html",
              "**/build-types",
              "**/manifest",
            ],
          },
        },
        {
          from: "ui",
          to: "ui",
        },
      ],
    }),
    {
      apply: (compiler) => {
        compiler.hooks.afterEmit.tap("AfterEmitPlugin", (compilation) => {
          // Run the JavaScript file after the compilation is done
          exec("node development/build/index.js", (error, stdout, stderr) => {
            if (error) {
              console.error(`exec error: ${error}`);
              return;
            }
            // Copy files from the temp folder to other folders
            fs.readdirSync(path.resolve(__dirname, "dist")).forEach((dest) => {
              copyFolderSync("dist/chrome", `dist/${dest}`);
            });
          });
        });
      },
    },
  ],
};



Source link

ECPair Issue tinysecp256k1 Webpack
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
admin
  • Website

Related Posts

Coinbase Expands USDC Loans to UK After Strong US Demand – Bitcoin News

April 20, 2026

Stablecoins can help businesses turn costs into revenue, but not everyone needs to issue a token:

April 19, 2026

SIGN is available for trading!

April 18, 2026

AI Trading Agents: Useful Tool or Security Liability?

April 17, 2026
Add A Comment
Leave A Reply Cancel Reply

Top Insights

Coinbase Expands USDC Loans to UK After Strong US Demand – Bitcoin News

April 20, 2026

🚀 GRABBER BOT — no more missed trades – My Trading – 20 April 2026

April 20, 2026

The Market’s Compass Emerging Markets Country ETF Study

April 20, 2026

Stablecoins can help businesses turn costs into revenue, but not everyone needs to issue a token:

April 19, 2026
ads

Subscribe to Updates

Get the latest creative news from Cointelegraphe about Crypto, bItcoin and Altcoin.

About Us
About Us

At CoinTelegraphe, we are dedicated to bringing you the latest and most insightful news, analysis, and updates from the dynamic world of cryptocurrency. Our mission is to provide our readers with accurate, timely, and comprehensive information to help them navigate the complexities of the crypto market.

Facebook X (Twitter) Instagram Pinterest YouTube
Top Insights

Coinbase Expands USDC Loans to UK After Strong US Demand – Bitcoin News

April 20, 2026

🚀 GRABBER BOT — no more missed trades – My Trading – 20 April 2026

April 20, 2026

The Market’s Compass Emerging Markets Country ETF Study

April 20, 2026
Get Informed

Subscribe to Updates

Get the latest creative news from Cointelegraphe about Crypto, bItcoin and Altcoin.

Please enable JavaScript in your browser to complete this form.
Loading
  • About us
  • Contact Us
  • Shop
  • Privacy Policy
  • Terms and Conditions
Copyright 2024 Cointelegraphe Design By Horaam Sultan.

Type above and press Enter to search. Press Esc to cancel.