Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
big.js node module not working with webpack

I'm trying to use webpack to compile (typescript files) and bundle up my source code. Here is my current webpack.config.js file:

const path = require('path')

module.exports = {
  devtool: 'eval-source-map',
  entry: './src/main.ts',
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: 'ts-loader',
        include: [
          path.resolve(__dirname, 'src'),
        ]
      }
    ]
  },
  resolve: {
    extensions: ['.ts', '.js']
  },
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  }
}

I also have big.js installed as a node module. However, when I run webpack and bundle all the files into bundle.js. It runs the bundled code (known by console.log messages printing to console), but I get the following error in the browser:

Uncaught Error: Cannot find module 'big.js'

and it points to the following line of code:

import Big from "big.js";

I know big.js is included because looking in the bundle.js file, the top of the file has the big.js bundled (shown as below):

(()=>{var __webpack_modules__={302:function(module,exports,__webpack_require__){eval("var __WEBPACK_AMD_DEFINE_RESULT__;/*\r\n *  big.js v6.1.1\r\n *  A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.\r\n *  Copyright (c) 2021 Michael Mclaughlin\r\n *  https://github.com/MikeMcl/big.js/LICENCE.md\r\n */\r\n;(function (GLOBAL) {\r\n  'use strict';\r\n  var Big,\r\n\r\n\r\n/...

This is my first time using webpack and big.js so the solution is hopefully simple, but if someone knew what the issue was, your help would be appreciated. If any further information is needed, let me know.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda