1

I have been trying to research this on my own, but I can't find a simple explanation that tells me the difference between the following 2 files:

lwc.config.jsonhttps://developer.salesforce.com/blogs/2020/09/lightning-web-components-module-resolution.html

lwc-services.config.jshttps://github.com/muenzpraeger/create-lwc-app/blob/main/packages/lwc-services/example/lwc-services.config.js

Are they both necessary or is it a "one or the other" thing we creating an LWC OSS app?

1 Answer 1

1

lwc.config.json

This is needed if you need module resolution in your LWC OSS project. LWC OSS provides a native modulation resolution for indicating app entry module and bringing third-party npm module and exposing your lwc components as a module.

This is a requirement by lwc compiler.

You will only need the lwc.config.json to indicate the entry point for the lwc app. So your project will definitely have one. You can also bring third-party npm or expose your components for distribution using the same file.

This is explained a bit in this quick take video1 and video2

lwc-services.config.js

This is needed if you are using the create lwc app for the creation of lwc. The project is open source and provides lwc-services npm for helping you manage other aspects of your JavaScript web application.

Note it is not mandatory to use this project for scaffolding. You can use rollup or parcel or any other module bundler for managing your web app. However, this project is opinionated with webpack and gives you a head start. It gives you a project with webpack config and an express server for building client server web app including a PWA app.

The lwc-services.config.js is used to indicate app settings documented here. The file also has the ability to specify webpack custom config.

So both will be needed if you are using the create lwc app for your project else only lwc.config.json.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.