Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sashsvamir/webpack-delete-no-js-entries-plugin
This Webpack plugin will delete empty js files from output. This plugin will be applied only for entries with no js files (e.g. entries with styles only files).
https://github.com/sashsvamir/webpack-delete-no-js-entries-plugin
Last synced: about 1 month ago
JSON representation
This Webpack plugin will delete empty js files from output. This plugin will be applied only for entries with no js files (e.g. entries with styles only files).
- Host: GitHub
- URL: https://github.com/sashsvamir/webpack-delete-no-js-entries-plugin
- Owner: sashsvamir
- License: mit
- Created: 2018-08-26T12:09:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-11T07:49:17.000Z (over 5 years ago)
- Last Synced: 2024-10-29T20:57:19.181Z (about 1 month ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-star - webpack-delete-no-js-entries-plugin
README
Webpack delete no js entries plugin
===================================If you build your app with multiply entries with no js files, e.g. entry only with styles, output of your app contains empty js files for that entry.
This Webpack plugin will delete empty js files from output.
This plugin will be applied only for entries with no js files.
## Installation
:small_orange_diamond: This plugin works with Webpack 4+.
```shell
npm install webpack-delete-no-js-entries-plugin --save-dev
```## Usage
In your webpack config, require the plugin then add an instance to the `plugins` array.
```js
const WebpackDeleteNoJsEntriesPlugin = require('webpack-delete-no-js-entries-plugin');module.exports = {
entry: {
// 'app' entry with js file
app: [
'./app.js',
'./app.sass',
],
// 'page' entry with no js point
page: [
'./page.sass'
],
},
output: {
path: path.join( __dirname, 'dist' ),
filename: '[name]-[hash].js',
chunkFilename: '[id]-[chunkhash].js',
},
module: {
// Your loader rules go here.
},plugins: [
new WebpackDeleteNoJsEntriesPlugin(),
],};
```## Sample output
:small_orange_diamond: With this plugin applied, webpack output of `page` entry will without `page.js` file, but with `page.css`:
```
"app.js"
"app.css"
"page.css"
```If you build app without this plugin, webpack output of `page` entry will be with empty `page.js` file:
```
"app.js"
"app.css"
"page.js" <-- empty js file
"page.css"
```