I can't use a symlinked package
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- javascript, react-native
- 領域
- build-system, tooling
調査の方向性
記載されている npm、React Native、Lerna のコマンドを使ってセットアップを再現し、その後 packages/package1/package.js にあるパッケージエントリと、App.tsx からのそのインポートを調査します。Metro ベースの React Native アプリが symlink されたパッケージをどのように解決するかを追跡します。パッケージをインポートでき、報告された失敗なしに CustomButton がレンダリングされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
Hello everyone, after the new update of react native with version 0.72, and support for Symlink, I wanted to create a small project to test these features, but when importing a package created with lerna for a monorepo, I can't import it and use it correctly.
React Native Version
0.72.1
Output of npx react-native info
info Fetching system and libraries information...
System:
OS: Linux 5.19 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
Memory: 5.50 GB / 15.54 GB
Shell:
version: 5.1.16
path: /bin/bash
Binaries:
Node:
version: 18.16.1
path: ~/.nvm/versions/node/v18.16.1/bin/node
Yarn:
version: 1.22.19
path: /home/linuxbrew/.linuxbrew/bin/yarn
npm:
version: 9.5.1
path: ~/.nvm/versions/node/v18.16.1/bin/npm
Watchman:
version: 2022.06.20.00
path: /home/linuxbrew/.linuxbrew/bin/watchman
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 11.0.19
path: /usr/bin/javac
Ruby:
version: 3.0.2
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.1
wanted: 0.72.1
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Steps to reproduce
First I create an empty folder
mkdir monorepo && cd monorepo
I create a react native app
npx react-native@latest init AwesomeProject
I start lerna
lerna init
I create new package with lerna
lerna create package1
I modify packages/package1/package.js with this code:
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
export const CustomButton = ({ onPress, title }) => {
return (
<TouchableOpacity onPress={onPress}>
<Text>{title}</Text>
</TouchableOpacity>
);
};
I run react native in RN project (still without adding the lerna package)
/monorepo/AwesomeProject$ npm start
/monorepo/AwesomeProject$ npm run android
- The project runs correctly
I install my lerna package
/monorepo/AwesomeProject$ npm install ../packages/package1
I check that it has been installed in package.json
"dependencies": {
"package1": "file:../packages/package1",
"react": "18.2.0",
"react-native": "0.72.1"
},
I go to App.tsx and import the package:
import {CustomButton} from 'package1';
And I use it:
<View>
<CustomButton
title="Press me!"
onPress={() => console.log('Hello!')}
/>
</View>
Snack, code example, screenshot, or link to a repository
App.spx full code:
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React from 'react';
import type {PropsWithChildren} from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';
import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import {CustomButton} from 'package1';
type SectionProps = PropsWithChildren<{
title: string;
}>;
function Section({children, title}: SectionProps): JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
return (
<View style={styles.sectionContainer}>
<Text
style={[
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}>
{title}
</Text>
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? Colors.light : Colors.dark,
},
]}>
{children}
</Text>
</View>
);
}
function App(): JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
backgroundColor={backgroundStyle.backgroundColor}
/>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<Header />
<View
style={{
backgroundColor: isDarkMode ? Colors.black : Colors.white,
}}>
<Section title="Step One">
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
screen and then come back to see your edits.
</Section>
<View>
<CustomButton
title="Press me!"
onPress={() => console.log('Hello!')}
/>
</View>
<Section title="See Your Changes">
<ReloadInstructions />
</Section>
<Section title="Debug">
<DebugInstructions />
</Section>
<Section title="Learn More">
Read the docs to discover what to do next:
</Section>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
});
export default App;
Screen error:
- 主要言語
- JavaScript
- スター
- 5.6k
- フォーク
- 702
- 平均マージ
- 3日 7時間
- マージ済み PR(30日)
- 63
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react/metro のほかの issue
-
constant-folding-plugin emits 0/0 (NaN) for arithmetic on destructured bindings対応中かも @cpruijsen が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
-
[0.83.x] Backport micromatch removal and dotfile/multipart watcher fix together対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
メンテナーはふだん 2 日以内に返信
-
`dependencies is not iterable` / `Cannot read property 'reduce' of undefined`: `FileStore` serves zero-prefixed cache files as hits対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
Async chunk URLs drop the file extension, so .cjs async imports fail with "Requiring unknown module"対応中かも @dasjideepak が 19 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
react/metro#1959 · コメント 2 件 · リアクション 2 件 ·
メンテナーはふだん 2 日以内に返信
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
maproulette/maproulette-frontend#2944 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
jaegertracing/jaeger-ui#4618 ·
メンテナーはふだん 1 日以内に返信
-
area:plugins enhancement platform:vscode
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
anthropics/claude-code#103166 ·
メンテナーはふだん 1 日以内に返信
-
Add: Kids Zone Logoオープンcheck:failed logos:add
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
-
[workshop-sim] Improve: Add verifiable checkpoint and bridge to Step 5 (What Are Agentic Workflows?)オープンfeedback simulation workshop
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
githubnext/gh-aw-workshop#4715 ·
メンテナーはふだん 1 日以内に返信