developit / developit/microbundle

Broken build due to mangled dependency props

未关闭
#819 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
8.1k
派生
358
PR 合并指标
30 天内没有已合并 PR

描述

I have some code that imports a named export of a dependency as follows:
```js
import { _fn } from '@x/y';
...
_fn(...); // calling _fn
```

With mangle configured with `"regex": "^_[^_]"`, the default build (`index.js`) transpiles this to:
```js
const z = require('@x/y');
...
z.a(...); // calling _fn???
```

Disabling mangling works as expected:
```js
const z = require('@x/y');
...
z._fn(...); // calling _fn
```

There is a similar problem with the umd build.

Any way around this?

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先,使用所示的具名导入和 mangle 正则表达式重现默认构建和 UMD 构建,然后在禁用 mangling 的情况下比较它们生成的 require 调用。完成的标准是:对依赖项 `_fn` export 的调用在两个构建中都保持有效,同时本地名称仍然可以进行 mangling。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
build-system
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。