How to use javascript export and import

Asked 2 years ago, Updated 2 years ago, 63 views

//./hoge.js
class HOGE {}
class FUGA {}
classPIYO{}

↑Create a file like this

//./fuga.js
import* from './hoge';
// ↑↓ Either way is possible
import {HOGE, FUGA, PIYO} from 'hoge';

↑ I would like to be able to use it like this, but on the ./hoge.js side, how should I do export?

javascript es6

2022-09-30 18:20

1 Answers

export class HOGE{}
export class FUGA {}
export class PIYO {}

I think it would be safe to export each class like this.


2022-09-30 18:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.