We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
启动调试以后,提示 Unable to resolve module ../style/public.less
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.myapp/.MainActivity } BUNDLE ./index.js
ERROR Error: Unable to resolve module ../style/public.less from D:\project\MyApp\node_modules@arco-design\mobile-react\esm\style.js:
None of these files exist:
1 | import '../style/public.less'; | ^ 2 | import './tabs/style'; 3 | import './sticky/style'; 4 | import './portal/style'; at ModuleResolver.resolveDependency (D:\project\MyApp\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:112:15) at DependencyGraph.resolveDependency (D:\project\MyApp\node_modules\metro\src\node-haste\DependencyGraph.js:235:43) at D:\project\MyApp\node_modules\metro\src\lib\transformHelpers.js:160:21 at resolveDependencies (D:\project\MyApp\node_modules\metro\src\DeltaBundler\buildSubgraph.js:42:25) at visit (D:\project\MyApp\node_modules\metro\src\DeltaBundler\buildSubgraph.js:83:30) at async Promise.all (index 3) at async visit (D:\project\MyApp\node_modules\metro\src\DeltaBundler\buildSubgraph.js:92:5) at async Promise.all (index 5) at async visit (D:\project\MyApp\node_modules\metro\src\DeltaBundler\buildSubgraph.js:92:5) at async Promise.all (index 2) BUNDLE ./index.js
ERROR app\pages\customer\index.tsx: Unknown option: .modulePaths. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options. BUNDLE ./index.js
ERROR app\pages\customer\index.tsx: Unknown option: .modulePaths. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
package.json引用如下:
"devDependencies": { "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.3", "@babel/runtime": "^7.25.0", "@react-native-community/cli": "15.0.1", "@react-native-community/cli-platform-android": "15.0.1", "@react-native-community/cli-platform-ios": "15.0.1", "@react-native/babel-preset": "0.76.5", "@react-native/eslint-config": "0.76.5", "@react-native/metro-config": "0.76.5", "@react-native/typescript-config": "0.76.5", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "babel-plugin-import": "^1.13.8", "babel-plugin-module-resolver": "^5.0.2", "eslint": "^8.19.0", "jest": "^29.6.3", "prettier": "2.8.8", "react-test-renderer": "18.3.1", "typescript": "5.0.4" }, "peerDependencies": { "react": ">=16.9.0", "react-dom": ">=16.9.0", "react-transition-group": ">=4.3.0" },
babel.config.js引用如下:
module.exports = { presets: ['module:@react-native/babel-preset'],
plugins: [ [ 'module-resolver', { root: ['./app'], extensions: ['.ios.js', '.android.js', '.js', '.ts', '.tsx', '.json'], alias: { '@': ['./app'], } } ], ["import", { "libraryName": "@arco-design/mobile-react", "libraryDirectory": "esm", // 注意如果是 SSR 环境,这里需使用 cjs "style": (path) => ${path}/style }, "@arco-design/mobile-react"], ["import", { "libraryName": "@arco-design/mobile-react/esm/icon", // 注意如果是 SSR 环境,这里需将 esm 替换为 cjs "libraryDirectory": "", "camel2DashComponentName": false }, "@arco-design/mobile-react/esm/icon"] ]
cjs
${path}/style
esm
};
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
项目有使用less-loader等处理less文件吗
有用到less文件
是不是arco-design-mobile不支持react-native?
对的,目前不支持哦,全局会有一些用到web相关的代码
No branches or pull requests
启动调试以后,提示 Unable to resolve module ../style/public.less
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.myapp/.MainActivity }
BUNDLE ./index.js
ERROR Error: Unable to resolve module ../style/public.less from D:\project\MyApp\node_modules@arco-design\mobile-react\esm\style.js:
None of these files exist:
ERROR app\pages\customer\index.tsx: Unknown option: .modulePaths. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
BUNDLE ./index.js
ERROR app\pages\customer\index.tsx: Unknown option: .modulePaths. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
package.json引用如下:
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.5",
"@react-native/eslint-config": "0.76.5",
"@react-native/metro-config": "0.76.5",
"@react-native/typescript-config": "0.76.5",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"babel-plugin-import": "^1.13.8",
"babel-plugin-module-resolver": "^5.0.2",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
},
"peerDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0",
"react-transition-group": ">=4.3.0"
},
babel.config.js引用如下:
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: [
[
'module-resolver',
{
root: ['./app'],
extensions: ['.ios.js', '.android.js', '.js', '.ts', '.tsx', '.json'],
alias: {
'@': ['./app'],
}
}
],
["import", {
"libraryName": "@arco-design/mobile-react",
"libraryDirectory": "esm", // 注意如果是 SSR 环境,这里需使用
cjs
"style": (path) =>
${path}/style
}, "@arco-design/mobile-react"],
["import", {
"libraryName": "@arco-design/mobile-react/esm/icon", // 注意如果是 SSR 环境,这里需将
esm
替换为cjs
"libraryDirectory": "",
"camel2DashComponentName": false
}, "@arco-design/mobile-react/esm/icon"]
]
};
The text was updated successfully, but these errors were encountered: