ブックマーク / memememomo.hatenablog.com (1)

  • import/exportとmodule.exports/require - メメメモモ

    概要 Node.jsのモジュール読み込み ES6(ECMAScript2015)のモジュール読み込み Typescriptのモジュール読み込み ES6と同じexport/import export =とimport = require() /// reference path まとめ 概要 Node.js、ES6、Typescriptを一気に調べていたせいで、いろいろなパターンのモジュール読み込み方法に出くわして、ちょっと混乱したので、整理しました。 Node.jsのモジュール読み込み Node.jsのモジュール読み込みは以下のような形になります。 // node/myModule.js class myModule { constructor() { console.log('Hello, I am a module'); } hello() { console.log('hello!'

    import/exportとmodule.exports/require - メメメモモ
    cha1ra
    cha1ra 2019/03/27
  • 1