glass-easel-miniprogram-webpack-plugin 0.5.1 → 0.5.2

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.
Files changed (3) hide show
  1. package/index.js +8 -4
  2. package/index.ts +12 -8
  3. package/package.json +5 -5
package/index.js CHANGED
@@ -210,6 +210,7 @@ class GlassEaselMiniprogramWebpackPlugin {
210
210
  catch (e) {
211
211
  /* empty */
212
212
  }
213
+ let hasScriptFile = false;
213
214
  try {
214
215
  const tsFileStat = yield node_fs_1.promises.stat(path.join(codeRoot, `${compPath}.ts`));
215
216
  if (tsFileStat.isFile()) {
@@ -218,9 +219,7 @@ class GlassEaselMiniprogramWebpackPlugin {
218
219
  taskConfig: staticConfig.taskConfig,
219
220
  hasWxss,
220
221
  };
221
- styleSheetManager.add(compPath, absPath);
222
- styleSheetManager.setStyleIsolation(compPath, staticConfig.styleIsolation, !!staticConfig.component);
223
- return;
222
+ hasScriptFile = true;
224
223
  }
225
224
  }
226
225
  catch (e) {
@@ -234,12 +233,17 @@ class GlassEaselMiniprogramWebpackPlugin {
234
233
  taskConfig: staticConfig.taskConfig,
235
234
  hasWxss,
236
235
  };
237
- return;
236
+ hasScriptFile = true;
238
237
  }
239
238
  }
240
239
  catch (e) {
241
240
  /* empty */
242
241
  }
242
+ if (hasScriptFile) {
243
+ styleSheetManager.add(compPath, absPath);
244
+ styleSheetManager.setStyleIsolation(compPath, staticConfig.styleIsolation, !!staticConfig.component);
245
+ return;
246
+ }
243
247
  }
244
248
  }
245
249
  // find wxss file for components
package/index.ts CHANGED
@@ -227,6 +227,7 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
227
227
  } catch (e) {
228
228
  /* empty */
229
229
  }
230
+ let hasScriptFile = false
230
231
  try {
231
232
  const tsFileStat = await fs.stat(path.join(codeRoot, `${compPath}.ts`))
232
233
  if (tsFileStat.isFile()) {
@@ -235,13 +236,7 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
235
236
  taskConfig: staticConfig.taskConfig,
236
237
  hasWxss,
237
238
  }
238
- styleSheetManager.add(compPath, absPath)
239
- styleSheetManager.setStyleIsolation(
240
- compPath,
241
- staticConfig.styleIsolation,
242
- !!staticConfig.component,
243
- )
244
- return
239
+ hasScriptFile = true
245
240
  }
246
241
  } catch (e) {
247
242
  /* empty */
@@ -254,11 +249,20 @@ export class GlassEaselMiniprogramWebpackPlugin implements WebpackPluginInstance
254
249
  taskConfig: staticConfig.taskConfig,
255
250
  hasWxss,
256
251
  }
257
- return
252
+ hasScriptFile = true
258
253
  }
259
254
  } catch (e) {
260
255
  /* empty */
261
256
  }
257
+ if (hasScriptFile) {
258
+ styleSheetManager.add(compPath, absPath)
259
+ styleSheetManager.setStyleIsolation(
260
+ compPath,
261
+ staticConfig.styleIsolation,
262
+ !!staticConfig.component,
263
+ )
264
+ return
265
+ }
262
266
  }
263
267
  }
264
268
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "glass-easel-miniprogram-webpack-plugin",
3
3
  "description": "The webpack plugin of the glass-easel project for MiniProgram file structure",
4
- "version": "0.5.1",
4
+ "version": "0.5.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/wechat-miniprogram/glass-easel.git"
@@ -18,16 +18,16 @@
18
18
  "main": "index.js",
19
19
  "peerDependencies": {
20
20
  "webpack": "^5.85.0",
21
- "glass-easel": "0.5.1",
22
- "glass-easel-miniprogram-adapter": "0.5.1"
21
+ "glass-easel": "0.5.2",
22
+ "glass-easel-miniprogram-adapter": "0.5.2"
23
23
  },
24
24
  "dependencies": {
25
25
  "chokidar": "^3.5.3",
26
26
  "source-map": "^0.7.4",
27
27
  "webpack-sources": "^3.2.1",
28
28
  "webpack-virtual-modules": "^0.5.0",
29
- "glass-easel-stylesheet-compiler": "0.5.1",
30
- "glass-easel-template-compiler": "0.5.1"
29
+ "glass-easel-stylesheet-compiler": "0.5.2",
30
+ "glass-easel-template-compiler": "0.5.2"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "tsc -p .",