Here some examples where this could be tricky: The more tooling you introduce in your application, the more complicated it becomes to get it configured. You might think: Nice, I only need to do once this configuration!Īnd the answer is: it depends. But luckily we are always using a tool that supports that (e.g. JavaScript itself does not allow us doing that those imports natively. A lot of waste of energy having to navigate to the code. Let's see an example of a tiny and not too nested app folder structure:Ĭopied import React from "react" import and sometimes, creating subfolders inside these folders and as consequence, creating a deeply nested structure. Notwithstanding we don't have a standard of "how to structure", we always try to organize like components, helpers, models, etc. In well-structured JavaScript applications it's common we organize our codebase in a way that makes explicit what these files do or each domain they belong to. The idea here is to do not stitch in any specific framework/tool but to give you an idea of knowing what and how to do, based on your application setup.įirst, let's check what problem we're trying to solve, a solution in a more abstract way and how to configure your project to support that. This is might be an old topic but I think it still can be a bit confused when you try to do this configuration: How can I add aliases to my imports? This article was published on Nov 29, 2020, and takes approximately 9 minutes to read. Module Resolution or Import Alias: The Final GuideĪ guide how to enable this feature in (almost) any JS/TS project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |