Falborian
Falborian

Reputation: 1

Can't resolve module while doing ES6 import

I am trying to import bignumber.js package into my project, but I keep failing to do so. Whenever I use statement

import {BigNumber} from 'bignumber';

or

import BigNumber from 'bignumber';

which are the statements taken directly from bignumber.js documentation, the error I am getting is:

./src/Component.js
Module not found: Can't resolve 'bignumber' in 
'PROJECT_DIR\src'

In PROJECT_DIR\node_modules bignumber is indeed installed and I am unable to grasp what the problem is exactly.
I would be grateful for any insight towards this problem.
Cheers!

Upvotes: 0

Views: 301

Answers (1)

AndreasT
AndreasT

Reputation: 1001

If you want to import bignumber.js package use:
import { BigNumber } from "bignumber.js"

You can view an example here: codesandbox-bignumber
I included also big-number module/example for the case that you want to use this module.

Upvotes: 1

Related Questions