npm install babel-plugin-root-import --save-dev
npm install babel-plugin-import --save-dev
npm install --dev babel-eslint
.eslintrc.js中添加
module.exports = {
root: true,
extends: '@react-native-community',
parse: 'babel-eslint',
};
创建.babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
['import', {libraryName: '@ant-design/react-native'}],
[
"babel-plugin-root-import",
{
rootPathSuffix: "./src",
rootPathPrefix: "@/"
}
]
]
};