@lynx-js/css-extract-webpack-plugin 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/CssExtractRspackPlugin.js +13 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -79,6 +79,18 @@ class CssExtractRspackPlugin {
|
|
|
79
79
|
}
|
|
80
80
|
export { CssExtractRspackPlugin };
|
|
81
81
|
class CssExtractRspackPluginImpl {
|
|
82
|
+
/**
|
|
83
|
+
* Check if Hot Module Replacement (HMR) is enabled
|
|
84
|
+
* @param compiler - the webpack/rspack compiler
|
|
85
|
+
* @returns true if HMR is enabled, false otherwise
|
|
86
|
+
*/
|
|
87
|
+
isHMREnabled(compiler) {
|
|
88
|
+
const hasHMRPlugin = compiler.options.plugins?.some(plugin => plugin && plugin.name === 'HotModuleReplacementPlugin') ?? false;
|
|
89
|
+
const hasDevServerHot = (compiler.options.devServer
|
|
90
|
+
&& compiler.options.devServer.hot !== false) ?? false;
|
|
91
|
+
// Return true only if HMR plugin exists or devServer.hot is not false
|
|
92
|
+
return hasHMRPlugin || hasDevServerHot;
|
|
93
|
+
}
|
|
82
94
|
constructor(compiler, options) {
|
|
83
95
|
this.options = options;
|
|
84
96
|
this.name = 'CssExtractRspackPlugin';
|
|
@@ -93,8 +105,7 @@ class CssExtractRspackPluginImpl {
|
|
|
93
105
|
runtime: options.runtime ?? false,
|
|
94
106
|
}).apply(compiler);
|
|
95
107
|
compiler.hooks.thisCompilation.tap(this.name, (compilation) => {
|
|
96
|
-
if (compiler
|
|
97
|
-
|| process.env['NODE_ENV'] === 'development') {
|
|
108
|
+
if (this.isHMREnabled(compiler)) {
|
|
98
109
|
const hooks = LynxTemplatePlugin.getLynxTemplatePluginHooks(
|
|
99
110
|
// @ts-expect-error Rspack to Webpack Compilation
|
|
100
111
|
compilation);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/css-extract-webpack-plugin",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "This plugin extracts CSS into separate files. It creates a CSS file per JS file which contains CSS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"mini-css-extract-plugin": "^2.9.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@microsoft/api-extractor": "7.52.
|
|
48
|
-
"@rspack/core": "1.5.
|
|
47
|
+
"@microsoft/api-extractor": "7.52.15",
|
|
48
|
+
"@rspack/core": "1.5.8",
|
|
49
49
|
"css-loader": "^7.1.2",
|
|
50
50
|
"sass-loader": "^16.0.5",
|
|
51
51
|
"webpack": "^5.101.3",
|