hw-weapp-compiler 1.0.12 → 1.0.13

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.
@@ -10,7 +10,6 @@ const { getEntries } = require('../config/getEntries');
10
10
  const { loadModule } = require('../utils/loadModule');
11
11
 
12
12
  module.exports = async function loader(source) {
13
- this.cacheable(true);
14
13
  const filePath = this.resourcePath;
15
14
  const fileInfo = path.parse(filePath);
16
15
  const sourceStr = source.toString();
@@ -18,8 +17,14 @@ module.exports = async function loader(source) {
18
17
  const imports = [sourceStr];
19
18
 
20
19
  const entries = await getEntries();
20
+ const entryPath = path.resolve(fileInfo.dir, fileInfo.name);
21
+ const isEntryFile = Object.values(entries).indexOf(entryPath) !== -1;
21
22
 
22
- if (Object.values(entries).indexOf(path.resolve(fileInfo.dir, fileInfo.name)) !== -1) {
23
+ // 入口 JS 会通过 loadModule 产出同名 json/wxml。若入口模块命中持久化缓存,
24
+ // dev 二次启动时 output.clean 删除后的 app.json 不会重新 emit。
25
+ this.cacheable(!isEntryFile);
26
+
27
+ if (isEntryFile) {
23
28
  const exts = ['.less', '.wxss', '.css', '.json', '.wxml'];
24
29
  const checks = await Promise.all(
25
30
  exts.map(async (ext) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hw-weapp-compiler",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "基于 webpack5 的小程序构建工具,兼容 Node.js 14~24",
5
5
  "main": "index.js",
6
6
  "bin": {