hw-weapp-compiler 1.0.10 → 1.0.11

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.
@@ -24,10 +24,6 @@ module.exports = async (options, { analyzer, quiet } = {}) => {
24
24
  const appConfig = getAppConfig();
25
25
  const { alias = {}, publicPath = 'auto', copyFiles = [] } = getConfig();
26
26
 
27
- // swc externalHelpers 产物里有 require("@swc/helpers/..."),本包作为编译器被 npm 安装到
28
- // 用户项目时,@swc/helpers 通常落在本包内层 node_modules 而非用户项目顶层,用户源码
29
- // 所在目录向上解析不到 → 构建直接 Module not found。固定指到本包内的绝对路径。
30
- alias['@swc/helpers'] = path.dirname(require.resolve('@swc/helpers/package.json'));
31
27
  const entries = await getEntries();
32
28
 
33
29
  const assetsName = (resourcePath) => {
@@ -318,14 +314,16 @@ module.exports = async (options, { analyzer, quiet } = {}) => {
318
314
  options: {
319
315
  cacheDirectory: true,
320
316
  // 用 env 模式按 chrome 53 降级,等价原 babel preset-env targets.chrome53。
321
- // swc 不再产出 regeneratorRuntime,而是 require("@swc/helpers/...") 配原生生
322
- // 成器(chrome 53 原生支持 function*),由上方 resolve.alias 固定解析到本包内。
317
+ // 关闭 externalHelpers:helper 内联进每个使用文件,不 require("@swc/helpers")
318
+ // 也不产 regeneratorRuntime(chrome 53 原生支持 function*)。
319
+ // 绝不能开 externalHelpers —— @swc/helpers 是 ESM 形态 `export { ... as _ }`,
320
+ // 经 webpack 转 CJS 后小程序 appservice 模块加载器对 exports key `_` 用
321
+ // Object.defineProperty 且不可重定义,会抛 `Cannot redefine property: _`。
323
322
  env: {
324
323
  targets: { chrome: '53' },
325
324
  },
326
325
  jsc: {
327
326
  parser: { syntax: 'ecmascript' },
328
- externalHelpers: true,
329
327
  },
330
328
  module: { type: 'commonjs' },
331
329
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hw-weapp-compiler",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "基于 webpack5 的小程序构建工具,兼容 Node.js 14~24",
5
5
  "main": "index.js",
6
6
  "bin": {