You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin removes empty `js` scripts generated when using only the styles like `css``scss``sass``less``stylus` in the webpack entry.
17
+
Webpack generates a js file for each resource defined in Webpack entry.\
18
+
The `mini-css-extract-plugin` extract CSS, but not eliminate a generated empty js file.\
19
+
See the [mini-css-extract-plugin issue](https://github.com/webpack-contrib/mini-css-extract-plugin/issues/151).
20
+
```js
21
+
module.exports= {
22
+
entry: {
23
+
styles:'./styles.scss', // generates expected `styles.css` and unexpected `styles.js`
24
+
},
25
+
}
26
+
```
27
+
This plugin remove unexpected empty js file.
11
28
12
-
This is improved fork of original plugin [webpack-fix-style-only-entries](https://github.com/fqborges/webpack-fix-style-only-entries) ver. 0.6.0.\
13
-
This fork fixes deprecation messages, issues when using React and some specific plugins.
14
29
15
-
The plugin support only `Webpack 5`.
16
-
For `Webpack 4` use original [plugin](https://github.com/fqborges/webpack-fix-style-only-entries).
30
+
> **Note**
31
+
>
32
+
> This is improved fork of the plugin [webpack-fix-style-only-entries](https://github.com/fqborges/webpack-fix-style-only-entries) v0.6.0.\
33
+
> The plugin support `Webpack 5` only.
34
+
> For `Webpack 4` use original [plugin](https://github.com/fqborges/webpack-fix-style-only-entries).
17
35
18
36
> **Warning**
19
37
>
20
38
> The new version `1.0.0` has probable `BRAKING CHANGE`.\
21
39
> In this version was reverted defaults behavior as in `v0.8.1` - remove empty scripts `before` processing other plugins.
22
-
40
+
>
23
41
> **Migration to v1.0.0**
24
42
>
25
43
> When update from `<= v0.8.1`, nothing needs to be done.\
26
44
> When update from `v0.8.2 - v0.8.4`, if you have an issue, try to use new `stage` option with `RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS` value.
27
45
28
-
## Description of the problem
29
-
30
-
Webpack generates a js file for each resource defined in a webpack entry.
31
-
Some extract plugins use webpack entry to define non-js resources.
32
-
For example, in webpack entry might be defined resources like js, css, scss, html, pug, etc.
33
-
Each resource type needs its own extract plugin and loader. Such a extract plugin should take care of eliminating the phantom js files for non-js resources by self.
34
-
But the `mini-css-extract-plugin` not do it.
35
-
This plugin fixes this, finds and removes phantom js files for non-js resources.
36
-
37
-
```js
38
-
module.exports= {
39
-
entry: {
40
-
main:'./main.js', // the generated `main.js` is what we expect
41
-
styles:'./main.scss', // will be generated the expected `styles.css` and the unexpected `styles.js`
You don't need anymore to use `html-webpack-plugin``mini-css-extract-plugin``webpack-remove-empty-scripts` and `pug-loader`.
97
-
The single `pug-plugin` replaces all most used functions of these plugins and loaders.
98
-
Keep your webpack config clear and clean.
85
+
The single `pug-plugin` replaces the functionality of `html-webpack-plugin``mini-css-extract-plugin``webpack-remove-empty-scripts` and `pug-loader`.
99
86
100
87
---
101
88
@@ -153,7 +140,7 @@ Values:
153
140
For example, exact this stage needs for properly work of the `@wordpress/dependency-extraction-webpack-plugin`.
154
141
155
142
Webpack plugins use different stages for their functionality.
156
-
For properly work other plugins can be specified the `stage` when should be removed empty scripts: before or after processing of other webpack plugins.
143
+
For properly work other plugins can be specified the `stage` when should be removed empty scripts: before or after processing of other Webpack plugins.
157
144
158
145
See [usage example](#usage-stage-optoion).
159
146
@@ -271,6 +258,60 @@ new RemoveEmptyScriptsPlugin({
271
258
`npm run test:coverage` will run the tests with coverage.
0 commit comments