Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lodash 引入问题 #381

Closed
forrest-lee opened this issue Jul 25, 2018 · 6 comments
Closed

lodash 引入问题 #381

forrest-lee opened this issue Jul 25, 2018 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@forrest-lee
Copy link

forrest-lee commented Jul 25, 2018

问题描述
引入lodash.get后报错

复现步骤

  1. yarn add lodash.get
  2. 在组件内引入lodash.get import get from 'lodash.get' 后使用get方法会报错
import get from 'lodash.get';
// 此处省略若干代码
get(object, 'propName', 'defaulValue');

报错信息
image

系统信息

  • 操作系统: MacOS 10.13.6
  • Taro 版本 v0.0.73
  • Node.js 版本 v9.11.1

补充信息

dist/npm/lodash.get/index.js 的导出方式为 module.exports = get;

image

解决方案
加上module.exports.default = get;

@forrest-lee
Copy link
Author

forrest-lee commented Jul 25, 2018

引入 moment 同样有问题
image

解决方法
module.exports改为modules.exports.default
image

@forrest-lee
Copy link
Author

不知道能否统一加上module.exports.default = module.exports

@luckyadam
Copy link
Member

luckyadam commented Jul 27, 2018

可以可以~ 可以在编译的时候处理~

@luckyadam luckyadam self-assigned this Jul 27, 2018
@luckyadam luckyadam added the enhancement New feature or request label Jul 27, 2018
@HecateDK
Copy link

这个问题应该解决了吧,我在1.0.0-beta.8版本的时候是好的
image

@luckyadam
Copy link
Member

@LionRock 试试最新的 beta 版本呢

@stale
Copy link

stale bot commented Oct 24, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants