I recently encountered an issue with my Vue files. I have 3 files, each containing a script section. Surprisingly, when the chance js library is imported correctly, all 3 scripts output a well-defined object for console.log(chance)
.
However, things took a turn when I made a mistake in importing the library:
import {chance} from 'chance'; //<=this is an incorrect import but strangely works in other files
instead of
import {Chance} from 'chance'; //<=this is the correct way of importing
In this scenario, the first script logs undefined while the second and third scripts continue to output the same object as before. Can anyone shed some light on why this behavior occurs?