
LWC open source application supports only single-page applications and there is no config attribute in lwc-services.config.js which enable us to make our app multi-page.
In a single-page application, LWC takes a single entry point as index.js and merges it with index.html to generate a final html file.
Structure of single page LWC project is as follows :
But our requirement was to implement multi-page application which can have structure as follows :
For more details on this topic you can contact us on : yuvraj.lohiya@ibirdsservices.com aslam.bari@ibirdsservices.com
After doing some research my team and I found a solution which uses a custom webpack configuration file. We found out that there is an attribute ‘-w’ for lwc-services watch, lwc-services build commands. It takes the location of a custom webpack configuration file, which will be merged into the default config.
In that custom webpack configuration file, we need to provide multiple entries. An entry point indicates which module webpack should use to begin building out its internal dependency graph. webpack will figure out which other modules and libraries that entry point depends on (directly and indirectly).
Also we can use plugins which are used to customize the build process in a variety of ways. While loaders are used to transform certain types of modules, plugins can be leveraged to perform a wider range of tasks like bundle optimization, asset management and injection of environment variables.
Also we need to provide a module resolver which allows us to access modules in our js files. A resolver is a library which helps in locating a module by its absolute path. A module can be required as a dependency from another module.
After reading the above resources, we can write our own custom webpack configuration file which can be used to build LWC open source app which will run as a multi-page application as follows :
In that custom webpack configuration file, we need to provide multiple entries. An entry point indicates which module webpack should use to begin building out its internal dependency graph. webpack will figure out which other modules and libraries that entry point depends on (directly and indirectly).
Also we can use plugins which are used to customize the build process in a variety of ways. While loaders are used to transform certain types of modules, plugins can be leveraged to perform a wider range of tasks like bundle optimization, asset management and injection of environment variables.
Also we need to provide a module resolver which allows us to access modules in our js files. A resolver is a library which helps in locating a module by its absolute path. A module can be required as a dependency from another module.
After reading the above resources, we can write our own custom webpack configuration file which can be used to build LWC open source app which will run as a multi-page application as follows :
Yuvraj Lohiya
Senior Technical Lead
iBirds Software Services Pvt. Ltd.
For more details on this topic you can contact us on : yuvraj.lohiya@ibirdsservices.com aslam.bari@ibirdsservices.com
It's Really A Great Post. Looking For Some More Stuff.
ReplyDeleteDigital marketing company in Hyderabad
This comment has been removed by the author.
ReplyDeleteThanks for sharing
ReplyDeleteLeanpitch provides online training in DevOps during this lockdown period everyone can use it wisely.
DevOps Online Training
ReplyDeleteDevOps Online Training
click here to know about AWS CLI completely. This is the best platform to improve your aws skills.
ReplyDeleteAwesome post! Personally I like your site. . I am so impressed to read your content. I am looking forward for the next valuable and informative concept in your blog. Overall outstanding post. Carry on :) Well done!
ReplyDeleteIf you want Digital Marketing Serives :-
Digital marketing Service in Delhi
SMM Services
PPC Services in Delhi
Website Design & Development Packages
SEO Services PackagesLocal SEO services
E-mail marketing services
YouTube plans
Meri Fasal Mera Byora
ReplyDeleteYour information is really good and definitely that things are very useful. I'm impressed with your pleas to share much information with us.
ReplyDeleteconstruction logistics services London
This article content is really unique and amazing. This article really helpful and explained very well's i am really thankful to you for sharing keep it up..
ReplyDeleteDigital Marketing Service in Kanpur
I really want to thank the author for such a nice blog that helped me to understand why it is important. Email Marketing Services in Perth
ReplyDeleteThis article's content is really unique and amazing. This article really helpful and explained very well. So I am really thankful to you for sharing keep it up..
ReplyDeleteหวยà¸à¸à¸™à¹„ลน์จ่ายจริง
This article content is really unique and amazing.This article really helpful and explained very well.So i am really thankful to you for sharing keep it up..
ReplyDeleteDigital Marketing Services
Amazingly helpful which you have shared here. I am impressed by the details and also it is a significant article for us. Continue imparting this sort of info, Thank you.smm panel
ReplyDeleteHi,
ReplyDeleteThanks for the nice blog. It was very useful for me. keep sharing ! if want Trademark Registration in bangalore Income Tax Consultants in bangalore click on it
Thanks for sharing this information GIOSTAR is one of the best stem cell therapy in India. GIOSTAR has a capacity to treat a few destroying Immunological infirmities and Blood related infections. These unite Diabetes Type I and Type II, Lupus, Multiple Sclerosis, Crohn's burden, Vasculitis, Scleroderma, Myasthenia Gravis, Sickle Cell Anemia, Leukemia, Lymphoma, Thalassemia and building up the treatments for Alzheimer's, Autism, Anti-Aging Treatments, Parkinson's infection, Cancer, Heart and Retinal Degeneration, Amyotrophic Lateral Sclerosis, Neuropathy, Osteoarthritis, Paralysis, Strokes, Spinal Cord Injuries, Skin Burns and Spinal Muscular Atrophy (SMA). BestStem Cell Therapy in India, Hyderabad, Delhi, Bangalore,
ReplyDeletesmm panel Nice smm panel ever
ReplyDeletesmm panel Best
ReplyDeletesmm panel Great panel
ReplyDeletesmm panel
ReplyDelete