# webpack-remove-empty-scripts

> Webpack plugin removes empty JavaScript files generated when using styles.

Latest version **1.1.1** (published 2025-05-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install webpack-remove-empty-scripts
pnpm add webpack-remove-empty-scripts
yarn add webpack-remove-empty-scripts
bun add webpack-remove-empty-scripts
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2025-05-26 |
| First published | 2020-10-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12.14 |
| Dependencies | 1 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | webdiscus |
| Maintainers | webdiscus |
| Keywords | webpack, plugin, remove, empty, script, entry, style, scss, sass, css, js, javascript |

## Links

- npm: https://www.npmjs.com/package/webpack-remove-empty-scripts
- Repository: https://github.com/webdiscus/webpack-remove-empty-scripts
- Homepage: https://github.com/webdiscus/webpack-remove-empty-scripts#readme
- Issues: https://github.com/webdiscus/webpack-remove-empty-scripts/issues
- Funding: https://patreon.com/biodiscus
- npm.io page: https://npm.io/package/webpack-remove-empty-scripts

## Dependencies (1)

- [ansis](https://npm.io/package/ansis.md) 4.0.0-node10

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.1 (latest) — 2025-05-26
- 1.0.0-beta.2 (beta) — 2022-03-31
- 1.1.0 — 2025-05-25
- 1.0.4 — 2023-08-28
- 1.0.3 — 2023-04-11
- 1.0.2 — 2023-04-07
- 1.0.1 — 2022-09-19
- 1.0.0 — 2022-09-12
- 0.8.4 — 2022-09-08
- 0.8.3 — 2022-09-04
- 0.8.2 — 2022-09-04
- 0.8.1 — 2022-06-14
- 0.8.0 — 2022-04-01
- 1.0.0-beta.1 — 2022-03-31
- 0.7.3 — 2022-01-30
- … 7 more at https://npm.io/package/webpack-remove-empty-scripts/versions

## README

<div align="center">
  <img width="120" height="120" src="https://cdn.worldvectorlogo.com/logos/logo-javascript.svg">
  <img width="120" height="120" vspace="" hspace="25" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon-square-big.svg">
  <h1><a href="https://github.com/webdiscus/webpack-remove-empty-scripts">webpack-remove-empty-scripts</a></h1>
</div>

A Webpack plugin to remove empty JavaScript files generated when using style only entries.

## Problem this plugin solves

By default, Webpack creates a JavaScript file for every entry specified in the `entry` option - even when the entry is a style file (like SCSS or CSS).

Example:

```js
module.exports = {
  entry: {
    styles: './styles.scss',
  },
}
```

Output:

```
dist/styles.css
dist/styles.js // <= unwanted empty JS file
```

When using `mini-css-extract-plugin`, CSS is correctly extracted into a separate file, but Webpack still emits an empty JavaScript file for each style-only entry - the [known issue](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/151).

This plugin detects and removes those redundant `.js` files automatically, keeping your output clean.

> **Note**
> 
> This plugin is compatible with `Webpack 5`. 
> For `Webpack 4` use [webpack-fix-style-only-entries](https://github.com/fqborges/webpack-fix-style-only-entries).

## Install
```bash
npm install webpack-remove-empty-scripts --save-dev
```

See the full [documentation](https://github.com/webdiscus/webpack-remove-empty-scripts) on GitHub.

---
_Source: https://npm.io/package/webpack-remove-empty-scripts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
