<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Harshal Shah</title>
    <description>The latest articles on DEV Community by Harshal Shah (@harshalshah26).</description>
    <link>https://dev.to/harshalshah26</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F326683%2Faf86bd74-da4e-4dd8-9985-39d4b0fe2742.jpeg</url>
      <title>DEV Community: Harshal Shah</title>
      <link>https://dev.to/harshalshah26</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harshalshah26"/>
    <language>en</language>
    <item>
      <title>MarkoJS Frontend Development with Generative AI: A Modern Approach</title>
      <dc:creator>Harshal Shah</dc:creator>
      <pubDate>Wed, 06 Nov 2024 14:11:35 +0000</pubDate>
      <link>https://dev.to/harshalshah26/markojs-frontend-development-with-generative-ai-a-modern-approach-3m9i</link>
      <guid>https://dev.to/harshalshah26/markojs-frontend-development-with-generative-ai-a-modern-approach-3m9i</guid>
      <description>&lt;p&gt;In the ever-evolving face of web development, MarkoJS takes center stage as one of the most capable front end frameworks, providing unique capabilities such as server-side rendering of HTML at compile time and greatly simplifying reactive components. Combining this with the newer capabilities of generative AI, MarkoJS cements its position to take on the needs of developers in creating modern, efficient, and dynamic web applications.&lt;/p&gt;

&lt;p&gt;In this article, we will explore MarkoJS generative AI in developing more intuitive front-end development that is intelligent, automates tasks, minimizes unnecessary work,  and crafts personalized user experiences.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is MarkoJS?
&lt;/h2&gt;

&lt;p&gt;MarkoJS is an extremely fast, efficient javascript based framework for user interface development. Unlike most traditional client-side frameworks, MarkoJS is good out of the box with server-side rendering and also supports reactive components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key features in MarkoJS include:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Declarative Syntax:&lt;/strong&gt; MarkoJS is based on a templating language that makes it much easier to construct reusable components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server side rendering:&lt;/strong&gt; Instead of immediately loading an empty page, HTML is rendered on the server, improving SEO and user experiences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Efficient reactivity:&lt;/strong&gt; Marko doesn’t re-render the entire page but updates those parts of UI which have changed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generative AI in Front end development
&lt;/h2&gt;

&lt;p&gt;Generative AI is a shorthand for algorithms, mainly machine learning models, which can independently create new content by leveraging the patterns they learn from data. This generative AI could assist a front end developer by doing the following:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Code Generations:&lt;/strong&gt; Automate mundane coding tasks, such as scaffolding of components, CSS styles, or even HTML markup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Content generations:&lt;/strong&gt; Dynamic creation of content on web pages, including personalized recommendations, blog posts or different UI variants.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Design systems:&lt;/strong&gt; Given user preferences or brand guidelines, automatically generate consistent UI layouts or designs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) Testing and debugging:&lt;/strong&gt; AI powered testing of an applications to uncover bugs, suggestions for optimizations or quite simply, the automated writing of unit tests for each component.&lt;/p&gt;

&lt;h2&gt;
  
  
  How MarkoJS can benefit from Generative AI
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1) Automatic component creation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;MarkoJS has declarative syntax that can be dynamically generated by AI. For example, generative AI might look at the existing components in a program and create new ones automatically if it sees a pattern. This can be useful for large applications with lots of repetitive components.&lt;/p&gt;

&lt;p&gt;For example, a generative AI model could learn your UI design pattern and generate a new Marko component for the user profile card from some design specifications. This reduces development time and would therefore assure consistency throughout the application.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;profile-card&amp;gt;&lt;br&gt;
  &amp;lt;div class="user-info"&amp;gt;&lt;br&gt;
    &amp;lt;img src=AI_GENERATED_AVATAR alt="user avatar"&amp;gt;&lt;br&gt;
    &amp;lt;h2&amp;gt;@AI_GENERATED_NAME&amp;lt;/h2&amp;gt;&lt;br&gt;
    &amp;lt;p&amp;gt;@AI_GENERATED_BIO&amp;gt;&amp;lt;/p&amp;gt;&lt;br&gt;
  &amp;lt;/div&amp;gt;&lt;br&gt;
&amp;lt;/profile-card&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Personalized user interface&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Generative AI can personalize web applications built on MarkoJS by generating active content to automatically adopt to user behavior. Suppose you are building an e-commerce site, AI will study what the user prefers and generate suggestions of related products, or even dynamically alter UI elements reflecting interests relevant to the said user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Optimizing Performance with AI-driven Predictions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;MarkoJS already has a name for performance out of the box, thanks to server side rendering and optimized reactivity. Still, generative AI could push the bar even higher in respect of performance. AI may anticipate user behavior and either preload or pre-render components users will most likely interact with. this kind of anticipatory loading is what makes applications feel snappier because it reduces perceived load times.&lt;/p&gt;

&lt;p&gt;It might, for example, use the customer’s past behavior on the shop’s website to allow it to pre-load Marko components for categories or products they have already demonstrated interest in so that the page appears immediately when they go to that section.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) Content generation for SEO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;MarkoJS is a great contender for SEO due to its capability of server side rendering HTML. Due to AI driven content generation tools, developers can generate SEO friendly content on the fly. Generative AI model such as GPT can generate product description, blog posts, or metadata tags that may be directly embedded into the server rendered HTML to improve search engine visibility.&lt;/p&gt;

&lt;p&gt;Through this, the AI generated content updates in real time to new trends, keywords, or search terms that user may use, thereby yielding a competitive edge on the website with respect to SEO rankings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5) AI assisted testing and debugging&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Generative AI extends this development workflow by providing the ability to automatically detect bugs or performance bottlenecks within MarkoJS applications. For instance, AI-driven utilities can scrutinize code for potential inefficiencies, propose optimizations, and even produce automated tests for your Marko components.&lt;/p&gt;

&lt;p&gt;For example, an AI tool can create unit tests for a form component in MarkoJS to ensure that said form acts as expected under a variety of conditions-everything from validation rules to API interactions.&lt;/p&gt;

&lt;p&gt;`describe('Form Component', () =&amp;gt; {&lt;br&gt;
  it('should render the form with default values', () =&amp;gt; {&lt;br&gt;
    const form = renderFormComponent();&lt;br&gt;
    expect(form.find(('input[name="username"]).value).toBe("");&lt;br&gt;
  });&lt;/p&gt;

&lt;p&gt;it('should show error message for invalid input', () =&amp;gt; {&lt;br&gt;
    const form = renderFormComponent({ username: "invalid_user"});&lt;br&gt;
    expect(form.find('error-message').textContent).toBe("invalid username")&lt;br&gt;
  });&lt;br&gt;
})&lt;br&gt;
`&lt;/p&gt;

&lt;h2&gt;
  
  
  Real world applications
&lt;/h2&gt;

&lt;p&gt;By integrating generative AI into MarkoJS, the following undustry use cases open up:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) E-Commerce:&lt;/strong&gt; Dynamic product recommendations and personalizations: AI content creation for marketing/SEO.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Content Platforms:&lt;/strong&gt; Personalized new feeds, auto generation of content, intelligent UI updates depending on user interactions&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Enterprise applications:&lt;/strong&gt; Automation of dashboard components, predective analytics embedded in th UI, and enhanced collaboration tools via AI generated content or components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With the integration of generative AI into MarkoJS, a whole new frontier of front end development has unfolded. Automation can free one up to more strategic levels of application build-designs, functionalities and business logic- so performance optimization and personalizations for user experiences could be meted out. MarkoJS is the perfect candidate for AI enhanced workflows due to its declarative, server side rendered approach; hence, enabling teams to build faster, smarter and more efficient web applications.&lt;/p&gt;

&lt;p&gt;In summary, generative AI will be a dominant factor in how front end development will be done in future, and some of these frameworks, like MarkoJS, will be at the fore.&lt;/p&gt;

</description>
      <category>generativeai</category>
      <category>marko</category>
      <category>frontend</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Turn your angular application into PWA through service worker</title>
      <dc:creator>Harshal Shah</dc:creator>
      <pubDate>Wed, 19 Feb 2020 19:36:55 +0000</pubDate>
      <link>https://dev.to/harshalshah26/turn-your-angular-application-into-pwa-through-service-worker-oal</link>
      <guid>https://dev.to/harshalshah26/turn-your-angular-application-into-pwa-through-service-worker-oal</guid>
      <description>&lt;p&gt;What is Service worker?&lt;/p&gt;

&lt;p&gt;A Service worker is a script (JavaScript file) that runs in background and contributes in offline first web application development. A Service worker cannot directly interact with the webpage nor it can directly access the DOM. It runs on a different thread but can communicate with webpages through messages (Post Messages).&lt;/p&gt;

&lt;p&gt;Service workers are fully asynchronous. They are working on a different thread  that’s why they don’t block your application in any way.&lt;/p&gt;

&lt;p&gt;APIs such as synchronous XHR and localStorage can’t be used inside a service worker.&lt;/p&gt;

&lt;p&gt;Service workers are terminated when not in use and restored when required.&lt;/p&gt;

&lt;p&gt;Service workers function as a network proxy. They intercept all outgoing HTTP requests made by the application and can choose how to respond to them. For example, they can query a local cache and deliver a cached response if one is available. Proxying isn't limited to requests made through programmatic APIs, such as fetch; it also includes resources referenced in HTML and even the initial request to index.html. Service worker-based caching is thus completely programmable and doesn't rely on server-specified caching headers.&lt;/p&gt;

&lt;p&gt;Service Workers in Angular&lt;/p&gt;

&lt;p&gt;Starting with version 5.0.0, Angular ships with a service worker implementation. Angular developers can take advantage of this service worker and benefit from the increased reliability and performance it provides, without needing to code against low-level APIs.&lt;/p&gt;

&lt;p&gt;The Angular service worker's behavior follows that design goal:&lt;/p&gt;

&lt;p&gt;Caching an application is like installing a native application. The application is cached as one unit, and all files update together.&lt;/p&gt;

&lt;p&gt;A running application continues to run with the same version of all files. It does not suddenly start receiving cached files from a newer version, which are likely incompatible.&lt;/p&gt;

&lt;p&gt;When users refresh the application, they see the latest fully cached version. New tabs load the latest cached code.&lt;/p&gt;

&lt;p&gt;Updates happen in the background, relatively quickly after changes are published. The previous version of the application is served until an update is installed and ready.&lt;/p&gt;

&lt;p&gt;The service worker conserves bandwidth when possible. Resources are only downloaded if they've changed.&lt;/p&gt;

&lt;p&gt;To support these behaviors, the Angular service worker loads a manifest file from the server. The manifest describes the resources to cache and includes hashes of every file's contents. When an update to the application is deployed, the contents of the manifest change, informing the service worker that a new version of the application should be downloaded and cached. This manifest is generated from a CLI-generated configuration file called ngsw-config.json.&lt;/p&gt;

&lt;p&gt;Why to add Service Worker in Angular application?&lt;/p&gt;

&lt;p&gt;Simple answer of this question is, to convert your application to WPA (Web Progressive Application) which responds even when there is no network connection.&lt;/p&gt;

&lt;p&gt;How to add Service Worker?&lt;/p&gt;

&lt;p&gt;Adding Service workers in angular app is as easy as adding a module. You just need to run following command.&lt;/p&gt;

&lt;p&gt;ng add @angular/pwa --project &lt;em&gt;project-name&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;where &lt;em&gt;project-name&lt;/em&gt; Is a name you already defined in your angular.json file.&lt;/p&gt;

&lt;p&gt;The above command will do following code change in your angular project out of the box. You do not need to do anything.&lt;/p&gt;

&lt;p&gt;1.Enables service worker build support in the CLI by installing related packages (‘@angular/pwa’ and ‘@angular/service-worker’). It also add those package in package.json file.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add following lines in index.html&lt;/li&gt;
&lt;/ol&gt;



&lt;ol&gt;
&lt;li&gt;Add following line in app.module imports.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;ServiceWorkerModule.register('ngsw-worker.js', { enabled: true })&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create manifes.webmanifest file is src folder&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create service worker configuration file called  ngsw-config.json file in root folder&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update angular.json file with following changes in configuration object.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;"configuration":  {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"production": {

    "serviceWorker": true,

     "ngswConfigPath": "ngsw-config.json"

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Installs icon files to support the installed Progressive Web App (PWA).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;How to debug Service Worker?&lt;/p&gt;

&lt;p&gt;1.Build the project&lt;br&gt;
  ng build –prod&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run the project with http-server&lt;br&gt;
http-server –port 8080 dist&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to localhost:8080 in browser. When you load first time with network, it will cached necessary resources(whatever you have mentioned in config file).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to network , checked offline and make network unavailable. Refresh the page and observe the network tab. You will see little gear icon and in the initiator column, you will see initiated by service-worker.js file.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Another way to debug whether Service workers are working correctly or not:&lt;/p&gt;

&lt;p&gt;To see the audits results, go to Audits in the developer tools of Google Chrome and run the audits. Audits will tell you whether your application satisfies all the criteria for PWA or not. If service workers are working correctly then you will see green dot next to following points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Registers a service worker that controls page and start_url&lt;/li&gt;
&lt;li&gt;Current page responds with a 200 when offline&lt;/li&gt;
&lt;li&gt;start_url responds with a 200 when offline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Above three points are the proof that your service workers are working correctly.&lt;/p&gt;

&lt;p&gt;See how easy to convert your angular application to PWA. Convert it today and let me know the feedback in comment.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>pwa</category>
      <category>serviceworkers</category>
    </item>
    <item>
      <title>Angular: Component vs Directive</title>
      <dc:creator>Harshal Shah</dc:creator>
      <pubDate>Thu, 06 Feb 2020 20:14:53 +0000</pubDate>
      <link>https://dev.to/harshalshah26/angular-component-vs-directive-5710</link>
      <guid>https://dev.to/harshalshah26/angular-component-vs-directive-5710</guid>
      <description>&lt;p&gt;Directives&lt;/p&gt;

&lt;p&gt;“The mechanism by which we attach behaviour to elements in the DOM, consisting of Structural, Attribute and Component types.”&lt;/p&gt;

&lt;p&gt;Angular templates are dynamic. When Angular renders them, it transforms the DOM according to the instructions given by directives. A directive is a class with a @Directive() decorator.&lt;/p&gt;

&lt;p&gt;In addition to components, there are two other kinds of directives: structural and attribute. Angular defines a number of directives of both kinds, and you can define your own using the @Directive() decorator.&lt;/p&gt;

&lt;p&gt;Just as for components, the metadata for a directive associates the decorated class with a selector element that you use to insert it into HTML. In templates, directives typically appear within an element tag as attributes, either by name or as the target of an assignment or a binding.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;import {Directive} from 'angular2/angular2';&lt;/p&gt;

&lt;p&gt;@Directive({&lt;br&gt;
    selector: "[myDirective]",&lt;br&gt;
    hostListeners: {&lt;br&gt;
        'click': 'showMessage()'&lt;br&gt;
    }&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;class Message {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;constructor() {
    // initilization
}

showMessage() { console.log('Hello Directive'); }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Click here&lt;/p&gt;

&lt;p&gt;Components&lt;/p&gt;

&lt;p&gt;“The specific type of directive that allows us to utilize web component functionality - encapsulated, reusable elements available throughout our application.”&lt;/p&gt;

&lt;p&gt;Components are basically just a new type of directive that is designed for component-based architecture. In a lot of ways, components are more restricted in their functionality, instead encouraging better conventions and design that actually leads to more maintainable and reusable code.&lt;/p&gt;

&lt;p&gt;Components are so distinctive and central to Angular applications that Angular defines the @Component() decorator, which extends the @Directive() decorator with template-oriented features.      &lt;/p&gt;

&lt;p&gt;“Component is a directive with a view or template”  &lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;import {Component, View} from 'angular2/angular2';&lt;/p&gt;

&lt;p&gt;@Component({&lt;br&gt;
  selector: 'message'&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;@View({&lt;br&gt;
  template: &lt;code&gt;&lt;br&gt;
      &amp;lt;h1&amp;gt;Hello Angular {{version}}&amp;lt;/h1&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;class Message {&lt;br&gt;
  constructor(public version: string) {}&lt;br&gt;
}&lt;/p&gt;



&lt;p&gt;Differences:&lt;/p&gt;

&lt;p&gt;Components&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For register component we use @Component meta-data annotation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Component is a directive which use shadow DOM to create encapsulate visual behavior called components.  Components are typically used to create UI widgets.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Component is used to break up the application into smaller components.&lt;/li&gt;
&lt;li&gt;Only one component can be present per DOM element.&lt;/li&gt;
&lt;li&gt;@View decorator or templateurl template are mandatory in the component.&lt;/li&gt;
&lt;li&gt;Component is used to define pipes&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Directives&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For register directives we use @Directive meta-data annotation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Directives is used to add behavior to an existing DOM element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Directive is use to design re-usable components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Many directive can be used in a per DOM element&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Directives don’t have View.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can’t define Pipes in directive.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>angular</category>
      <category>components</category>
      <category>directives</category>
    </item>
    <item>
      <title>Circular dependency warnings in angular</title>
      <dc:creator>Harshal Shah</dc:creator>
      <pubDate>Wed, 29 Jan 2020 21:28:09 +0000</pubDate>
      <link>https://dev.to/harshalshah26/circular-dependency-warnings-in-angular-4fhl</link>
      <guid>https://dev.to/harshalshah26/circular-dependency-warnings-in-angular-4fhl</guid>
      <description>&lt;p&gt;What is Circular Dependency?&lt;/p&gt;

&lt;p&gt;In software engineering, a circular dependency is a relation between two or more modules which either directly or indirectly depend on each other to function properly. Such modules are also known as mutually recursive.&lt;/p&gt;

&lt;p&gt;In very large software designs, software engineers may lose the context and inadvertently introduce circular dependencies. There are tools to analyze software and find unwanted circular dependencies.&lt;/p&gt;

&lt;p&gt;Circular Dependency in Angular&lt;/p&gt;

&lt;p&gt;Angular’s dependency injection is a great feature to productivity, but even it has its limits.&lt;/p&gt;

&lt;p&gt;While not an everyday occurrence, it is quite possible to come across a circular dependency. This happens when service A injects service B, but service B in turn injects service A, usually indirectly. For example, B depends on service C which depends on A –  A -&amp;gt; B -&amp;gt; C -&amp;gt; A  forms a nice little circle.&lt;/p&gt;

&lt;p&gt;When Angular’s bootstrap process tries to setup all the services and inject each service’s dependencies, it detects when such a scenario happens and errors out, instead of getting stuck in an infinite loop.&lt;/p&gt;

&lt;p&gt;In most cases, circular dependencies are code smells for design that could be made clearer. Most likely you have a service that’s gotten too big, and splitting it will result in cleaner code and no circular dependency.&lt;/p&gt;

&lt;p&gt;Circular Dependency can result in a crash of an application. We should definitely remove circular dependency present in codebase. &lt;/p&gt;

&lt;p&gt;Circular Dependency Warnings in Angular&lt;/p&gt;

&lt;p&gt;Circular dependency is definitely harmful but warnings about circular dependency may or may not be. Many times we get lots of circular dependency warnings but our application still runs smoothly.  So what are those warnings about?&lt;/p&gt;

&lt;p&gt;As I said, those may not be harmful, but definitely those are annoying. I would not love at all to see lots of yellow text yelling at me "You might be doing Something Wrong", when I build my application. Those warnings are the indication that you are doing something unusual in your code. &lt;/p&gt;

&lt;p&gt;Major Culprit for Circular dependency warning&lt;/p&gt;

&lt;p&gt;One of the major drawback of importing things thorough index file is it might cause circular dependency warning in your codebase during build if you don't use  index file wisely. &lt;/p&gt;

&lt;p&gt;Index.js is not about having to type out slightly shorter file names. It is about encapsulation. &lt;/p&gt;

&lt;p&gt;The idea is that your directories should have files and classes or services or whatever you want it have but everything this is public should be exported or exposed in the index.js.&lt;/p&gt;

&lt;p&gt;The idea is to never require a file from inside another directory directly as whatever it exposes should be that "package" 's internals and are private.&lt;/p&gt;

&lt;p&gt;Of course this is not enforced in JavaScript, but it is important for writing clean, well organised code.&lt;/p&gt;

&lt;p&gt;Let's say following is your directory structures.&lt;/p&gt;

&lt;p&gt;--- /Services&lt;br&gt;
           --- a.service.js&lt;br&gt;
           --- b.service.js&lt;br&gt;
           --- c.service.js&lt;br&gt;
           --- index.js&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  --- /models
       --- a.model.js
       --- b.model.js
       --- c.model.js
       --- index.js


  --- /Components
       --- /a
             --- a.component.js
             --- a.html
             --- a.scss
       --- /b
            --- b.component.js
            --- b.html
            --- b.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We have services, models and components. Services and models have import.js file which exports all services and models. So in any file if you require some service or model you can technically write:&lt;/p&gt;

&lt;p&gt;import AService from 'services';&lt;br&gt;
import Amodel from 'models';&lt;/p&gt;

&lt;p&gt;But if above line 1 is written in any  service file or line 2 written in any model file might generate circular dependency error. You should not use index import inside of the folder itself where index file stays. Index import is meant to be for outside files. &lt;/p&gt;

</description>
      <category>circular</category>
      <category>dependencywarning</category>
      <category>angular</category>
    </item>
  </channel>
</rss>
