{"id":2904,"date":"2024-07-02T09:34:02","date_gmt":"2024-07-02T15:34:02","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=2904"},"modified":"2024-07-02T09:34:04","modified_gmt":"2024-07-02T15:34:04","slug":"make-sure-you-can-switch","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/make-sure-you-can-switch\/","title":{"rendered":"Make Sure You Can Switch"},"content":{"rendered":"\n<p><a href=\"https:\/\/ckarchive.com\/b\/lmuehmh08vwdxid7kkm78cdoo5v00hg\">Nicholas C. Zakas<\/a> on the idea that we have choice in server-side JavaScript runtimes now, and you should be careful.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>&#8230; it makes sense to\u00a0<strong>preserve the ability to switch runtimes easily<\/strong>. It doesn\u2019t matter if you want to use Node.js or Deno or Bun in production right now. What you really want is the ability to change your mind later with as little pain as possible.<\/p>\n<\/blockquote>\n\n\n\n<p>Here&#8217;s his advice (truncated for brevity):<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ol class=\"wp-block-list\">\n<li><strong>Don\u2019t use Deno- or Bun-specific APIs.<\/strong>\u00a0Stick with Node APIs that are already supported in Deno and Bun.<\/li>\n\n\n\n<li><strong>Use the \u201cnode:\u201d prefix for Node.js internal modules.<\/strong>\u00a0Node works just fine when using the \u201cnode:\u201d prefix, so you can ensure compatibility across all three runtimes.<\/li>\n\n\n\n<li><strong>Use npm and JSR packages, not HTTP module specifiers.\u00a0<\/strong>Deno is still the only runtime to support URL modules, so it\u2019s best to stick with npm and JSR packages, which can be used across all three.<\/li>\n\n\n\n<li><strong>Use package.json for dependencies.<\/strong>\u00a0Don&#8217;t use the proprietary file formats which have no advantages.<\/li>\n\n\n\n<li><strong>Always run CI with Node, too.<\/strong>\u00a0Even if you\u2019re deploying to Deno or Bun, run CI in Node.<\/li>\n<\/ol>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Nicholas C. Zakas on the idea that we have choice in server-side JavaScript runtimes now, and you should be careful. &#8230; it makes sense to\u00a0preserve the ability to switch runtimes easily. It doesn\u2019t matter if you want to use Node.js or Deno or Bun in production right now. What you really want is the ability [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2905,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[194,116,147],"class_list":["post-2904","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-bun","tag-deno","tag-node"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/07\/Screenshot-2024-07-02-at-10.24.30%E2%80%AFAM.png?fit=2516%2C1540&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/2904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=2904"}],"version-history":[{"count":1,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/2904\/revisions"}],"predecessor-version":[{"id":2906,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/2904\/revisions\/2906"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/2905"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=2904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=2904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=2904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}