-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
import 插件导致 babel 得到的代码错误 #354
Comments
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
由于需要 Draggable 的 Modal,所以安装了 https://github.com/DylanVann/ant-design-draggable-modal 这个包,但是调了半天代码总是报错。
由于那个包开了 Source Map,所以一直是对照着源码去看的,后来在 Chrome 的设置里把 Source Map 禁用掉才发现问题:
在那个包的




draggableModalReducer
文件里,case 'show'
的那一段代码里,源代码是长这样的:index.es.js
和index.js
里的代码也是对的:但是在 Webpack 经过 babel 转码得到的代码却变成了这样:
其中
modalState_1
变量被转成了m
,而下面的var centerX = state.windowSize.width / 2 - modalState_1.width / 2;
中的modalState_1
应该被转成m
,可是却得到了antd_es_modal__WEBPACK_IMPORTED_MODULE_1__["default"]
,致使这里取width
属性是undefined
,导致整个包出现异常。禁用
babel-plugin-import
就正常了。babel.config.js
配置:The text was updated successfully, but these errors were encountered: