Easy Imports with NodeJS Subpath Imports

In this lesson, we'll learn about NodeJs Subpath Imports and how AdonisJS leverages them to help simplify our import paths throughout our application.

Published
Feb 06
Duration
8m 40s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

Want to dig further into NodeJS Subpath Imports? Checkout the documentation referenced within this lesson here:

https://nodejs.org/api/packages.html#subpath-imports


Update

As of TypeScript 5.4, TypeScript will read and use subpath imports directly from our package.json, meaning we no longer need to redefine them inside our tsconfig.json file.

As such, AdonisJS has now removed these definitions from the tsconfig.json file by default and you only need to define them inside your package.json file.

Join The Discussion! (4 Comments)

Please sign in or sign up for free to join in on the dicussion.

  1. Commented 3 months ago

    Not present by default in tsconfig.json

    0

    Please sign in or sign up for free to reply

    1. Commented 3 months ago

      Hi news-zanndo! Yes, as of TypeScript 5.4, TypeScript will now automatically use the subpath imports defined within your package.json, meaning we no longer need to redundantly re-define them inside the tsconfig.json.

      Apologies, I thought I had updated the body text for this lesson noting this, but evidently, I did not. Will do that now.

      2

      Please sign in or sign up for free to reply

      1. Commented 3 months ago

        Thank you for the explanation!

        1

        Please sign in or sign up for free to reply

        1. Commented 3 months ago

          Anytime, noctisy!!

          0

          Please sign in or sign up for free to reply