Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukethacoder/lwrjs-lwc-module-provider
⚡ An opinionated edit to the @lwrjs/lwc-module-provider package to add support for namespaces and multi directory modules (via @lukethacoder/lwc-module-resolver)
https://github.com/lukethacoder/lwrjs-lwc-module-provider
lightning-web-components lightning-web-runtime lwc lwr lwrjs salesforce
Last synced: 3 days ago
JSON representation
⚡ An opinionated edit to the @lwrjs/lwc-module-provider package to add support for namespaces and multi directory modules (via @lukethacoder/lwc-module-resolver)
- Host: GitHub
- URL: https://github.com/lukethacoder/lwrjs-lwc-module-provider
- Owner: lukethacoder
- License: mit
- Created: 2024-04-06T00:22:45.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-06T01:19:52.000Z (9 months ago)
- Last Synced: 2024-12-04T08:46:57.787Z (21 days ago)
- Topics: lightning-web-components, lightning-web-runtime, lwc, lwr, lwrjs, salesforce
- Homepage: https://npmjs.com/package/@lukethacoder/lwrjs-lwc-module-provider
- Size: 26.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @lukethacoder/lwrjs-lwc-module-provider
⚡ An opinionated edit to the [`@lwrjs/lwc-module-provider`](https://www.npmjs.com/package/@lwrjs/lwc-module-provider) package to add support for namespaces and multi directory modules (via [`@lukethacoder/lwc-module-resolver`](https://github.com/lukethacoder/lwc-module-resolver))
## Install
```
pnpm add @lukethacoder/lwrjs-lwc-module-provider
```Edit your `lwr.config.json` file to include the module.
```json
{
"lwc": {
"modules": [],
},
"moduleProviders": [
"@lwrjs/label-module-provider",
"@lwrjs/app-service/moduleProvider",
"@lukethacoder/lwrjs-lwc-module-provider",
"@lwrjs/npm-module-provider"
],
"routes": []
}
```## Custom Namespace Directories
> The heavy lifting of the enhancements come from the [`@lukethacoder/lwc-module-resolver`](https://github.com/lukethacoder/lwc-module-resolver/tree/main) package. Below is a snippet of the docs from that package.
Instead of assuming the namespace based on the folder structure, you can declaratively set namespaces to directories. Automatic namespacing is still enabled.
The primary driver for this is the on platform folder structure conflicting with the standard open source folder structure.
Multiple directory per namespace is also supported. This is great for package developers who wish to break up their code into smaller packages but still have the benefits of a local dev server.
```json
{
"modules": [
{
"dir": "src/modules"
},
{
"dir": "force-app/main/default/lwc",
"namespace": "c"
}
]
}
```This example shows how you can assign the `c` namespace to the default salesforce LWC folder, whilst still keeping the standard config for folder based namespacing.
## Multi Directory Namespacing
Multiple directory per namespace has also been added. This is great for package developers who wish to break up their code into smaller packages but still want to have the benefits of a local dev server.
```json
{
"modules": [
{
"dir": "src/modules"
},
{
"dir": "force-app/main/default/lwc",
"namespace": "c"
},
{
"dirs": [
"force-app/ui-account-flow/default/lwc",
"force-app/ui-shared/default/lwc"
],
"namespace": "ui"
}
]
}
```This example shows how you can assign the `ui` namespace to multiple source folders, whilst still keeping the standard config for folder based namespacing.
> NOTE:
> This package aims to open up current imitations enforced by open source LWC and on-platform Salesforce development. This is done purely to make your life as a developer easier and is not intended to be used as a part of a production build. These enhancements may allow you to do things that will **NOT** work on-platform.