Failed to package @antv/my-f2 in DingTalk custom component
- Dominant language
- TypeScript
- Stars
- 6
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
- [ ] I have searched the [issues](https://github.com/antvis/f2/issues) of this repository and believe that this is not a duplicate.
### Reproduction link
[https://github.com/xiaoyierle/ding-component-demo.git](https://github.com/xiaoyierle/ding-component-demo.git)
### Steps to reproduce
1. The current application is the DingTalk applet application
2. Develop through small program development tools
3. Error when packing
"@antv/my-f2": "^2.1.7" will have problems, 2.1.4 will be fine
Error when compressing code, please check if ES6 syntax is used in node_modules, ES6 code will cause iOS9/iOS10 runtime white screen
Error location: /tmp/data/onetime_tmp_dir/976174aa-addf-495f-b1eb-12fef4ae5593-1653099623859/tiny-ZpiEFs6od-1653099623890/main/index.worker.js:1763:313
Error message: ./plugin/node_modules/@antv/f2/node_modules/@antv/adjust/lib/symmetric.js
@antv/util/lib/array/merge not found, please check package.json configuration and try to reinstall node_modules dependencies
Module not found: Can't resolve '@antv/util/lib/array/merge' in '/tmp/data/build/plugin/node_modules/@antv/f2/node_modules/@antv/adjust/ lib'
-------------
./plugin/node_modules/@antv/f2/node_modules/@antv/adjust/lib/symmetric.js
@antv/util/lib/math/max-by not found, please check package.json configuration and try to reinstall node_modules dependencies
Module not found: Can't resolve '@antv/util/lib/math/max-by' in '/tmp/data/build/plugin/node_modules/@antv/f2/node_modules/@antv/ adjust/lib'
-------------
./plugin/node_modules/@antv/f2/node_modules/@antv/adjust/lib/stack.js
@antv/util/lib/type/is-array not found, please check package.json configuration and try to reinstall node_modules dependencies
Module not found: Can't resolve '@antv/util/lib/type/is-array' in '/tmp/data/build/plugin/node_modules/@antv/f2/node_modules/@antv/ adjust/lib'
-------------
./plugin/node_modules/@antv/f2/node_modules/@antv/adjust/lib/symmetric.js
@antv/util/lib/type/is-array not found, please check package.json configuration and try to reinstall node_modules dependencies
Module not found: Can't resolve '@antv/util/lib/type/is-array' in '/tmp/data/build/plugin/node_modules/@antv/f2/node_modules/@antv/ adjust/lib'
-------------
./plugin/node_modules/@antv/f2/node_modules/@antv/adjust/lib/stack.js
@antv/util/lib/type/is-nil not found, please check package.json configuration and try to reinstall node_modules dependencies
Module not found: Can't resolve '@antv/util/lib/type/is-nil' in '/tmp/data/build/plugin/node_modules/@antv/f2/node_modules/@antv/ adjust/lib'
-------------
index.worker.js from UglifyJs
Unexpected token: operator «*», expected: punc «(» [index.worker.js:1763,313]
Repair method: According to the error message, find the module containing ES6 syntax in node_modules
1. Contact the module developer to release the corresponding ES5 version, or try to update the dependencies (recommended)
2. Create a new mini.project.json in the root directory of the applet, add the module to the whitelist, for example:
{
"node_modules_es6_whitelist": [
"mod1",
"@alipay/mod2"
]
}
means node_modules/mod1, node_modules/@alipay/mod2 2 modules will do babel ES6->ES5 conversion
| Environment | Info |
|---|---|
| f2 | 4.0.20 |
| System | MAC OS 12.3.1 |
| Browser | chrome 101.0.4951.64(正式版本) (x86_64) |
---
Is it possible to solve this babel conversion problem from the code level?
Contributor guide
Research direction
Reproduce the packaging failure with the linked ding-component-demo repository and inspect the references from @antv/adjust/lib/symmetric.js and lib/stack.js, along with the package.json configuration. Check the generated index.worker.js and mini.project.json behavior first. Done means @antv/my-f2 2.1.7 packages successfully without missing @antv/util modules or ES6 compression errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100