# @lukethacoder/lwc-webpack-plugin

> ⚡ An opinionated Webpack plugin for LWC based on the official @salesforce/lwc-webpack-plugin plugin

Latest version **4.3.0** (published 2024-04-04) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @lukethacoder/lwc-webpack-plugin
pnpm add @lukethacoder/lwc-webpack-plugin
yarn add @lukethacoder/lwc-webpack-plugin
bun add @lukethacoder/lwc-webpack-plugin
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.3.0 |
| Published | 2024-04-04 |
| First published | 2023-04-25 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 18.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Luke Secomb |
| Maintainers | lukethacoder |
| Keywords | lwc, salesforce, web components, lightning, webpack |

## Links

- npm: https://www.npmjs.com/package/@lukethacoder/lwc-webpack-plugin
- Repository: https://github.com/lukethacoder/lwc-webpack-plugin
- Homepage: https://github.com/lukethacoder/lwc-webpack-plugin#readme
- Issues: https://github.com/lukethacoder/lwc-webpack-plugin/issues
- npm.io page: https://npm.io/package/@lukethacoder/lwc-webpack-plugin

## Dependencies (1)

- [resolve](https://npm.io/package/resolve.md) ^1.22.8

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 4.3.0 (latest) — 2024-04-04
- 4.2.0 — 2023-11-08
- 4.1.1 — 2023-10-23
- 4.1.0 — 2023-10-23
- 4.0.2 — 2023-06-30
- 4.0.1 — 2023-06-28
- 4.0.0 — 2023-06-27
- 3.0.4 — 2023-06-14
- 3.0.3 — 2023-04-25

## README

# lwc-webpack-plugin

⚡ An opinionated Webpack plugin for LWC based on the official [`@salesforce/lwc-webpack-plugin`](https://github.com/salesforce/lwc-webpack-plugin).

This plugin allows you to use LWC within any web framework project that uses Webpack.

## Updates

A list of changes and additions to the official [`@salesforce/lwc-webpack-plugin`](https://github.com/salesforce/lwc-webpack-plugin) plugin.

- Adds support for namespaces and multi directory modules (as per [@lukethacoder/lwc-module-resolver](https://github.com/lukethacoder/lwc-module-resolver))
- Adds support for `rootDir`, instead of defaulting to `process.cwd()`

## Install

```
pnpm add -D @lukethacoder/lwc-webpack-plugin @lukethacoder/lwc-module-resolver lwc
```

Note that you must install your own dependencies for `lwc` and `@lukethacoder/lwc-module-resolver`.

## Usage

```javascript
const LwcWebpackPlugin = require('@lukethacoder/lwc-webpack-plugin')

module.exports = {
  plugins: [new LwcWebpackPlugin()]
}
```

The above example assumes that you have configured LWC modules via `lwc.config.json` in your project root, or as `lwc` key in your `package.json`.

Pass the `module` configuration as parameter to the plugin, if you prefer to not use any of the above mentioned LWC module configuration options.

```javascript
const LwcWebpackPlugin = require('@lukethacoder/lwc-webpack-plugin')

module.exports = {
  plugins: [
    new LwcWebpackPlugin({
      rootDir: './my-cool-project',
      modules: [
        {
          dirs: [
            './shared/main/default/lwc',
            './project1/main/default/lwc',
            './project2/main/default/lwc',
          ],
          namespace: 'c',
        },
        { npm: 'lwc-recipes-oss-ui-components' },
        { npm: 'lightning-base-components' }
      ]
    })
  ]
}
```

The plugin takes also three additional configuration options:

- `rootDir` - defaults to `process.cmd()`
- `stylesheetConfig`
- `outputConfig`

These options are 1:1 mappings of the LWC Compiler options, which are documented [here](https://github.com/salesforce/lwc/tree/master/packages/%40lwc/compiler#apis).

---
_Source: https://npm.io/package/@lukethacoder/lwc-webpack-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
