Jins Chow
Jins Chow

Reputation: 51

How to export ES6 module and import it

I have a file like this :

let Utils = {
  //random stuff code
}

module.exports = Utils

I wanna run import Utils form 'Utils' anywhere, what I should do?

Upvotes: 2

Views: 59

Answers (1)

Sean
Sean

Reputation: 2729

let Utils = {
  //random stuff code
}

export default Utils

Then:

import Utils from '/path/to/utils';

Upvotes: 2

Related Questions