xhs-mp-compiler-cli 1.3.8 → 1.3.10-beta.0

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.
@@ -90,6 +90,7 @@ class XhsAssetsPlugin {
90
90
  const { project, packSetting, packMode } = this.options;
91
91
  const { compilePkgs = [const_1.default.MAIN_PKG] } = packSetting;
92
92
  // const { mainPkg, subPkgs } = packSetting.getCompilePkgsForEntries()
93
+ appJSON.allowLazyAppJs = true; // 允许预加载业务包标识 for 客户端
93
94
  // 先删除,用户配置的默认不生效
94
95
  Reflect.deleteProperty(appJSON, 'lazyCodeLoading');
95
96
  if (packSetting.enableVDom) {
@@ -122,7 +122,8 @@ function genServiceLoderScript(project, context, opts) {
122
122
  const addAppJs = () => {
123
123
  if (fs_extra_1.default.existsSync(`${projectMiniprogramPath}/app.js`) ||
124
124
  fs_extra_1.default.existsSync(`${projectMiniprogramPath}/app.ts`)) {
125
- modules.unshift(`;globalThis['${name}'].default['app'] = require('${(0, loader_utils_1.formatPath)(`${projectMiniprogramPath}/app`)}')`);
125
+ modules.unshift(`const loadAppJs = () => require('${(0, loader_utils_1.formatPath)(`${projectMiniprogramPath}/app`)}');` +
126
+ `globalThis['${name}'].default['app'] = globalThis.lazyAppJs ? loadAppJs : loadAppJs()`);
126
127
  }
127
128
  };
128
129
  if (pkg === xhs_mp_pack_1.CONSTANTS.FULL_PKG) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xhs-mp-compiler-cli",
3
- "version": "1.3.8",
3
+ "version": "1.3.10-beta.0",
4
4
  "description": "xhs mp command tool.",
5
5
  "preferGlobal": true,
6
6
  "category": "esm",
@@ -82,11 +82,11 @@
82
82
  "webpack-bundle-analyzer": "^4.4.0",
83
83
  "webpack-chain": "^6.5.1",
84
84
  "webpack-sources": "^3.2.2",
85
- "xhs-mp-compiler-ml-loader": "^1.3.8",
86
- "xhs-mp-compiler-utils": "^1.3.8",
87
- "xhs-mp-pack": "^1.3.8",
88
- "xhs-mp-project": "^1.3.8",
89
- "xhs-mp-utils": "^1.3.8"
85
+ "xhs-mp-compiler-ml-loader": "^1.3.10-beta.0",
86
+ "xhs-mp-compiler-utils": "^1.3.10-beta.0",
87
+ "xhs-mp-pack": "^1.3.10-beta.0",
88
+ "xhs-mp-project": "^1.3.10-beta.0",
89
+ "xhs-mp-utils": "^1.3.10-beta.0"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/babel__generator": "7.6.3",