babel-plugin-import
babel-plugin-import copied to clipboard
Modularly import plugin for babel.
比如,src/xComponents 是自定义的组件库,那么该怎么配置呢?求大神指点。
When there are default and named export at the same time, we can handle it by `mixedDefaultAndNamedExport`
Resolve https://github.com/ant-design/babel-plugin-import/issues/423
在Multiple Targets模式下 webpack.config.js 注意babel-plugin-import各配置了一次 ```javascript var webpack = require('webpack') var path = require('path') var nodeExternals = require('webpack-node-externals'); module.exports = [ { name: 'node', ... module: { rules: [ ... {...
When using `babel-plugin-import` with antd it currently cant be used with vendor splitting or commonchunks. Can we investigate if we can get this working? using webpack analyzer shows that most...
## 错误信息  ## 对应代码 ```js import { DatePicker } from 'antd'; const { RangePicker } = DatePicker; ``` ## .babelrc ```js { "presets": [ "@babel/preset-react", [ "@babel/preset-env" ], "@babel/preset-typescript"...
I get this error (You are using a whole package of antd-mobile, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size) on the console. As you mentioned in the documents, I've...
你好, 通过阅读源码有一个疑惑, 在使用@babel/helper-module-imports的addNamed之后会将原有的导入变量变更, 如将: ``` import { DatePicker } from 'antd'; ``` 变为 ``` import _DatePicker from 'antd/es/date-picker'; ``` 这会导致模块内其他所有使用`DatePicker`的地方都需要改为`_DatePicker `, 我看源码里面是实现的方式是对所有可能使用变量的语句中进行检测替换, 但更好的方法可以通过作用域`file.scope.getBinding`来获取使用`DatePicker`的地方, 然后替换他们, 这样应该更加安全和更高的性能. 没有实测, 只是阅读[babel-plugin-lodash](https://github.com/lodash/babel-plugin-lodash), 发现他们是这样使用的.
``` config = injectBabelPlugin(['import', { libraryName: 'date-fns', libraryDirectory: '' }], config); ``` The modules are in the [node_modules/date-fns](https://github.com/date-fns/date-fns/tree/master/src) folder but it gave an error: > Module not found: Error: Can't...
支持transformToDefaultImport函数形式,返回`true` | `false`。#332