A collection of 123 tips that come in real handy when you need them. Originally posted as tweets on
my Twitter account,
and now gathered here so you can browse them easily.
Support ESM and CommonJS Uses of Your Library
💡 Writing a Node.js library using ES Modules instead of Common JS?
👉🏼 Support users who aren't using ESM by adding a mapping for the main export for your library in your package.json file.
💡 Need to quickly test some JavaScript/Node.js code?
👉🏼 Just discovered @RunJS_app by @lukehaas and it's a game changer! Much better than opening VSCode, creating a test.js file and running "node test.js". 😅
💡 Working with cookies? Don't forget to secure them:
👉🏼 HttpOnly — no access from JavaScript (document.cookie API)
👉🏼 Secure — send cookie over HTTPS only
👉🏼 SameSite (Strict/Lax) — send only when current URL matches cookie URL