From 1430b64842df6b408350b141f26e1be1cd272bcd Mon Sep 17 00:00:00 2001 From: gahusb Date: Fri, 3 Apr 2026 07:41:42 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20npm=20run=20dev=20TypeScript=20'as'=20?= =?UTF-8?q?=EB=AC=B8=EB=B2=95=20=EB=B3=80=ED=99=98=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(JSA-60)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit react-native 0.84.1의 index.js가 TypeScript 'as' 구문을 사용하지만 metro-react-native-babel-preset이 .js 파일에는 TypeScript transform을 적용하지 않아 dev 서버 실행 시 SyntaxError가 발생하던 문제 수정. babel.config.js를 추가하여 react-native 패키지의 .js 파일에도 @babel/plugin-transform-typescript가 적용되도록 구성. Co-Authored-By: Paperclip --- babel.config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 babel.config.js diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..99a8ac0 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,11 @@ +module.exports = { + presets: ['module:metro-react-native-babel-preset'], + overrides: [ + { + // react-native 0.84+ uses TypeScript 'as' syntax in .js files + // which the default preset doesn't handle for non-.ts files + test: /node_modules\/react-native\/.*\.js$/, + plugins: [['@babel/plugin-transform-typescript', { allowDeclareFields: true }]], + }, + ], +};