1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ESMとは

今まで、フロントエンドエンジニアにもかかわらず、ESM とはよく分からずに開発をしていたので、今回調べてみました。

ESMについて

ECMAScript の仕様の一部で、JavaScriptにおけるモジュールシステム。

  • JavaScriptファイルで別のJavaScriptファイルを読み込む仕組み
  • Common.js の上位互換
  • Node.js にも対応

モジュール(例)

// sample.js
const sample = () => {
 return 'test'
}

export {
 sample
}

呼び出して使う(例)

// index.js
import {sample} from './index.js'

const handleClick = () => {
 sample()
}

以上、ESM についてです。
今後追加で分かったことがありましたら、更新していく予定です。
間違いなどございましたら、教えていただきたいです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?