@lynx-js/css-extract-webpack-plugin 0.6.3 → 0.6.5

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lynx-js/css-extract-webpack-plugin
2
2
 
3
+ ## 0.6.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Set main thread JS basename to `lepusCode.filename` in tasm encode data. It will ensure a filename is reported on MTS error without devtools enabled. ([#1949](https://github.com/lynx-family/lynx-stack/pull/1949))
8
+
9
+ ## 0.6.4
10
+
11
+ ### Patch Changes
12
+
13
+ - Avoid generating `.css.hot-update.json` when HMR is disabled. ([#1811](https://github.com/lynx-family/lynx-stack/pull/1811))
14
+
3
15
  ## 0.6.3
4
16
 
5
17
  ### Patch Changes
@@ -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.options.mode === 'development'
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);
@@ -119,6 +130,7 @@ class CssExtractRspackPluginImpl {
119
130
  lepusCode: {
120
131
  root: undefined,
121
132
  lepusChunk: {},
133
+ filename: undefined,
122
134
  },
123
135
  manifest: {},
124
136
  customSections: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/css-extract-webpack-plugin",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
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,13 +44,13 @@
44
44
  "mini-css-extract-plugin": "^2.9.4"
45
45
  },
46
46
  "devDependencies": {
47
- "@microsoft/api-extractor": "7.52.13",
48
- "@rspack/core": "1.5.2",
47
+ "@microsoft/api-extractor": "7.52.15",
48
+ "@rspack/core": "1.6.5",
49
49
  "css-loader": "^7.1.2",
50
50
  "sass-loader": "^16.0.5",
51
- "webpack": "^5.101.3",
51
+ "webpack": "^5.102.0",
52
52
  "@lynx-js/css-serializer": "0.1.3",
53
- "@lynx-js/template-webpack-plugin": "0.9.0",
53
+ "@lynx-js/template-webpack-plugin": "0.9.2",
54
54
  "@lynx-js/test-tools": "0.0.0",
55
55
  "@lynx-js/vitest-setup": "0.0.0"
56
56
  },