タグ

Node.jsとJavaScriptに関するAutomatorのブックマーク (3)

  • 【Node.js】ES Moduleで__dirnameを使う方法

    問題・背景|ReferenceError: __dirname is not defined in ES module scope Node.jsで__dirnameを使用すると、現在のJavaScriptファイルが存在するフォルダーのパスを取得できる。 Node.jsを扱っている者なら、利用することが多い機能の1つだと思う。 がしかし、__dirnameはCommon JSでしかサポートされておらず、ES Moduleで利用しようとすると怒られてしまう。 ReferenceError: __dirname is not defined in ES module scope This file is being treated as an ES module because it has a '.js' file extension and '/example/example/exampl

    【Node.js】ES Moduleで__dirnameを使う方法
  • Full stack open

    You can discuss the course and related topics in our dedicated group on Discord https://study.cs.helsinki.fi/discord/join/fullstack and on Telegram: https://t.me/fullstackcourse. Please join the conversation! See here how to ask questions in a proper way Parts 0-8 and 13 of the course material is written by Matti Luukkainen. The content of part 9 is written by developers from Terveystalo. Part 10

  • ES6時代のNode.js

    ヤフー株式会社は、2023年10月1日にLINEヤフー株式会社になりました。LINEヤフー株式会社の新しいブログはこちらです。LINEヤフー Tech Blog こんにちは。情報システム部の伊藤(@koh110)です。 社内システムの開発、運用を担当しています。 今回、担当しているシステムをNode.js LTS(v4.x)へバージョンアップしました。 それに伴い実施したES6対応の中から3つの事例を紹介したいと思います。 varを撲滅しよう arrow functionを使おう callbackを撲滅しよう varを撲滅しよう varをlet, constに置き換えます。基はconstに置き換えます。 メリットは以下の点で、コードの品質向上につながると思います。 プログラム中で変更不可である事を明示的に示せる。 誤った使い方をした時にバグとして検出される。 varを利用するとブロック

    ES6時代のNode.js
  • 1