And then we need to either rename the file or more probably reorganise the folder structure and choose a different one. Just think the case that the project evolves and the utility file is referenced in multiple places. This is something that really annoys me and is not only that. Import TextService from './services/textService.js' įrom the example above we should realise that each time we need to use a piece of code in our application, we need to now in which exact folder we are and then start calculating the relative path to this file. Import Utility from './common/utility.jsx' A view of this example could be this one: Let’s say that we have a really simple components hierarchy that one uses the other. What is described on the other hand could easily applied in frameworks like Angular or just pure JavaScript code which is bundled through Webpack. This is the resolve section of Webpack configuration and how it can help us in day to day development.Īs mentioned earlier I am involved lately in multiple projects related to Reactjs so the example uses this library. In this post I will try to concentrate in a feature of the tool that most examples don’t use it and it’s very important according to my opinion. Webpack provides wider functionality except just referencing external JavaScript code but this is not the scope of this blog spot. It’s also my favourite tool to use it in the Reactjs project I am involved lately. Webpack is one of the solutions that are available out there and solves JavaScript reference modules problem.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |