RN에서의 Build에러

macOS 15.6.1
Node.js v22.17.0
React Native Bedrock 0.0.25
@react-native-bedrock/native 0.0.25
@react-native 0.72.6
@apps-in-toss/framework 0.0.40
@toss-design-system/react-native 0.9.1

npm run build 실행 시 다음과 같은 에러가 발생합니다

Error: Build failed with 75 errors:
node_modules/@react-native-bedrock/mpack-next/node_modules/@swc/helpers/esm/_ts_generator.js:1:33: ERROR: Could not resolve "tslib"

pages/0-1-def.tsx:1:43: ERROR: Could not resolve "react/jsx-runtime"
pages/0-1-def.tsx:4:44: ERROR: Could not resolve "react-native-bedrock"
pages/0-1-def.tsx:5:38: ERROR: Could not resolve "@toss-design-system/react-native"

시도했던 해결방법입니다

  1. 시스템 전역 yarn 캐시 삭제

  2. npm 캐시 정리

  3. node_modules & package-lock.json 재설치

  4. tslib 패키지 명시설치

  5. @apps-in-toss/framework 패키지 재설치

npm run dev는 제대로 작동합니다.

이 에러의 원인이 무엇인지 알 수 있을까요?
esbuild 설정에서 모듈 해결이 실패하는 이유는 무엇인가요?
dev는 잘 작동하지만 빌드만 실패하는 상황입니다.
해결 방법이 있다면 알려주실 수 있나요?

안녕하세요 :slight_smile:

    "@apps-in-toss/framework": "^0.0.40",
    "react-native-bedrock": "0.0.25",
    "@react-native-bedrock/native": "0.0.25",
    "react": "^18.2.0",
    "react-native": "0.72.6",
    "@toss-design-system/react-native": "0.9.1"

말씀하신 동일한 조건으로 테스트시, 빌드에러가 발생하지 않는데요 :cry:
뭔가 충돌이 있는듯한데, 새로 세팅해도 동일한 이슈가 계속 발생하나요 ?!

전 npm 을 사용했어요

동일하게 npm 사용했습니다.

"dependencies": {
    "@apps-in-toss/framework": "^0.0.40",
    "@react-native-async-storage/async-storage": "^1.24.0",
    "@react-native-bedrock/native": "0.0.25",
    "@tanstack/react-query": "^5.85.5",
    "@toss-design-system/react-native": "^0.9.1",
    "axios": "^1.6.0",
    "cors": "^2.8.5",
    "dotenv": "^16.3.1",
    "express": "^4.18.2",
    "helmet": "^7.1.0",
    "react": "^18.2.0",
    "react-native": "^0.72.6",
    "react-native-bedrock": "^0.0.25"
  },
  "devDependencies": {
    "@babel/core": "7.23.9",
    "@babel/plugin-proposal-class-properties": "^7.16.7",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
    "@babel/plugin-proposal-numeric-separator": "^7.16.7",
    "@babel/plugin-proposal-optional-chaining": "^7.16.7",
    "@babel/plugin-proposal-private-methods": "^7.18.6",
    "@babel/plugin-proposal-private-property-in-object": "^7.18.6",
    "@babel/plugin-transform-flow-strip-types": "^7.19.0",
    "@babel/preset-env": "^7.15.0",
    "@babel/preset-react": "^7.16.7",
    "@babel/preset-typescript": "^7.16.7",
    "@babel/runtime": "7.18.9",
    "@testing-library/react-native": "^12.9.0",
    "@types/babel__core": "^7.20.5",
    "@types/cors": "^2.8.17",
    "@types/express": "^4.17.21",
    "@types/jest": "^29.5.14",
    "@types/node": "^22.10.2",
    "@types/react": "18.3.3",
    "jest": "^29.7.0",
    "react-test-renderer": "18.2.0",
    "tsx": "^4.6.2",
    "typescript": "^5.8.3"

혹시 패키지 중 충돌가능성이 있는 패키지나 버전이 존재하는지 확인가능하실까요?

완전히 동일하게

"dependencies": {
    "@apps-in-toss/framework": "^0.0.40",
    "@react-native-async-storage/async-storage": "^1.24.0",
    "@react-native-bedrock/native": "0.0.25",
    "@tanstack/react-query": "^5.85.5",
    "@toss-design-system/react-native": "^0.9.1",
    "axios": "^1.6.0",
    "cors": "^2.8.5",
    "dotenv": "^16.3.1",
    "express": "^4.18.2",
    "helmet": "^7.1.0",
    "react": "^18.2.0",
    "react-native": "^0.72.6",
    "react-native-bedrock": "^0.0.25"
  },
  "devDependencies": {
    "@babel/core": "7.23.9",
    "@babel/plugin-proposal-class-properties": "^7.16.7",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
    "@babel/plugin-proposal-numeric-separator": "^7.16.7",
    "@babel/plugin-proposal-optional-chaining": "^7.16.7",
    "@babel/plugin-proposal-private-methods": "^7.18.6",
    "@babel/plugin-proposal-private-property-in-object": "^7.18.6",
    "@babel/plugin-transform-flow-strip-types": "^7.19.0",
    "@babel/preset-env": "^7.15.0",
    "@babel/preset-react": "^7.16.7",
    "@babel/preset-typescript": "^7.16.7",
    "@babel/runtime": "7.18.9",
    "@testing-library/react-native": "^12.9.0",
    "@types/babel__core": "^7.20.5",
    "@types/cors": "^2.8.17",
    "@types/express": "^4.17.21",
    "@types/jest": "^29.5.14",
    "@types/node": "^22.10.2",
    "@types/react": "18.3.3",
    "jest": "^29.7.0",
    "react-test-renderer": "18.2.0",
    "tsx": "^4.6.2",
    "typescript": "^5.8.3"
  }

로 진행하여도 정상 빌드되었습니다 :cry:

import React from 'react';
import { View, StyleSheet, Image } from 'react-native';
import { BedrockRoute, useNavigation } from 'react-native-bedrock';
import { Txt, GridList, colors } from '@toss-design-system/react-native';

export const Route = BedrockRoute('/0-1-def', {
  validateParams: (params) => params,
  component: Def,
});

function Def() {
  const navigation = useNavigation();

  const handleSkiLesson = () => {
    navigation.navigate('/0-2-flow', { lessonType: 'ski' });
  };

  const handleBoardLesson = () => {
    navigation.navigate('/0-2-flow', { lessonType: 'board' });
  };

  return (
    <View style={styles.container}>


      <View style={styles.textContainer}>
        <Txt color={colors.grey700} style={styles.subtitle}>
          지금 나에게 필요한
        </Txt>
        <Txt fontWeight="bold" style={styles.title}>
          강습유형을 선택해주세요
        </Txt>
      </View>
      <View style={styles.gridContainer}>
        <GridList column={2} style={styles.gridList}>
          <GridList.Item
            image={
              <Image 
                source={{ uri: 'https://www.xxxxxxxxxxxxx' }} 
                style={styles.lessonImage}
                resizeMode="contain"
              />
            } 
            title="스키강습"
            onPress={handleSkiLesson}
            style={styles.gridItem}
          />
          <GridList.Item
            image={
              <Image 
                source={{ uri: 'https://www.xxxxxxxxxxx' }} 
                style={styles.lessonImage}
                resizeMode="contain"
              />
            } 
            title="보드강습"
            onPress={handleBoardLesson}
            style={styles.gridItem}
          />
        </GridList>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'white',
    paddingHorizontal: 20,
    paddingTop: '40%',
  },
  header: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    marginBottom: 20,
  },
  headerLeft: {
    padding: 10,
  },
  headerCenter: {
    flex: 1,
    alignItems: 'center',
  },
  headerRight: {
    flexDirection: 'row',
    padding: 10,
  },
  headerIcon: {
    marginLeft: 10,
  },
  profileImageContainer: {
    alignItems: 'center',
    marginBottom: 20,
  },
  textContainer: {
    alignItems: 'center',
    marginBottom: 0,
  },
  subtitle: {
    marginBottom: 0,
    textAlign: 'center',
  },
  title: {
    textAlign: 'center',
    fontWeight: 'bold',
  },
  gridContainer: {
    flex: 1,
    justifyContent: 'flex-start',
    marginTop: 16,
  },
  gridList: {
    gap: 0,
  },
  gridItem: {
    backgroundColor: '#f8f9fa',
    borderRadius: 12,
    padding: 20,
    alignItems: 'center',
    minHeight: 83,
  },
  lessonImage: {
    width: 36,
    height: 36,
    marginBottom: 8,
    marginTop: 8,
  },
});

        <Txt color={colors.grey700} style={styles.subtitle}>
          지금 나에게 필요한
        </Txt>
        <Txt fontWeight="bold" style={styles.title}>
          강습유형을 선택해주세요
        </Txt>
      </View>

      {/* 강습 유형 선택 그리드 */}
      <View style={styles.gridContainer}>
        <GridList column={2} style={styles.gridList}>
          <GridList.Item
            image={
              <Image 
                source={{ uri: 'https://www.rideordie.kr/images/skier.png' }} 
                style={styles.lessonImage}
                resizeMode="contain"
              />
            } 
            title="스키강습"
            onPress={handleSkiLesson}
            style={styles.gridItem}
          />
          <GridList.Item
            image={
              <Image 
                source={{ uri: 'https://www.rideordie.kr/images/boarder.png' }} 
                style={styles.lessonImage}
                resizeMode="contain"
              />
            } 
            title="보드강습"
            onPress={handleBoardLesson}
            style={styles.gridItem}
          />
        </GridList>
      </View>
    </View>
  );
}

오류코드에 명시된 파일인 0-1-def.tsx 코드 전문 첨부합니다.
어디가 문제인지 파악이 전혀 되지 않습니다. :sob: