-
Notifications
You must be signed in to change notification settings - Fork 9
CRA(Create React App)
11μ 23μΌ κΈ°μ€ CRA λ‘ react νλ‘μ νΈ μμ±ν λΉλ μ react-scripts:4.0.0μμ μλ μλ¬κ° λ°μνκ³ μλ€
TypeError: Cannot assign to read only property 'jsx' of object '#<Object>'
μλ js νμΌμμ ν΄λΉ μλ¬κ° λ°μνκ³ μμΌλ©° κ΄λ ¨ ν€μλ κ²μ μ λ¬Έμ λ°μ μκ° κΈ°μ€ 24μκ° μ΄λ΄μ μμ±λ κ²μκΈμμ μΈκΈμ΄ λκ³ μλ κ²μΌλ‘ νμΈλμλ€.
/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js:239
-
ν΄κ²°λ°©μ
μ΄ν λ¬Έμ ν΄κ²°μ μ°¨λκ° μλ€κ° 11μ 23μΌ 2μ~3μ μ¬μ΄ react-scripts 4.0.1 μ΄ λ¦΄λ¦¬μ¦ λμκ³ μ΅μ CRAμ μμ‘΄μ±μ΄ λ³κ²½ λμλ€.
6μμ CRAλ‘ react νλ‘μ νΈ μμ± ν λΉλ κ²°κ³Ό μ μμ μΈ νμ΄μ§ μλ΅μ΄ νμΈλλ€.
νμ§λ§ μμ λ¬Έμ μ μ΄μ΄μ emotion μ μ© μ μλμ κ°μ μλ¬κ° λ°μνλ€.
SyntaxError: pragma and pragmaFrag cannot be set when runtime is automatic.
-
μλ
ν΄λΉ μλ¬λ₯Ό κ²μν΄μ μ΅κ·Ό React17κ³Ό Emotion10 μ migrating λ¬Έμ κ° μλ κ²μ΄ νμΈλλ€.
Migrating to React 17 and Fixing the JSX Runtime Error with Emotion
μμ κ²μκΈμμ λͺ μλ λ°©μμ μ μ©ν κ²°κ³Όλ λ€μκ³Ό κ°λ€.
1λ² λ°©μ μ μ© μ μλ¬
2λ² λ°©μ μ μ© μ μλ¬
κ²°κ΅ μμ λ°©μμΌλ‘λ ν΄κ²°μ΄ λμ§ μμλ€.
λν tsconfig.jsμμ μλμ κ°μ κ²½κ³ λ₯Ό 보μ΄λ©΄μ jsx κ°μ react λ‘ λ°κΎΌ μνμμ λΉλ μ μλμΌλ‘ react-jsx λ‘ λ°κΏλ²λ¦°λ€.
Argument for '--jsx' option must be: 'preserve', 'react-native', 'react'
Cannot use JSX unless the '--jsx' flag is provided
-
ν΄κ²°λ°©μ
λ€μ λ λ§ν¬λ₯Ό μ°Έκ³ νλ€.
μλ λ§ν¬μ μνλ©΄ vs codeκ° intelliSenseλ₯Ό μν΄ μ¬μ©νκ³ μλ typescript λ²μ κ³Ό node_modulesμ μ€μΉλ typescript λ²μ μ΄ μΌμΉνμ§ μμ λ°μνλ λ¬Έμ λΌκ³ νλ€. κ·Έλ¬λ―λ‘ μλ λ λ°©μ μ€ νλλ₯Ό μ μ©νλ€.
-
vs code νλ¨μ νμλ typescript λ²μ μ ν΄λ¦ν΄ node_modulesμ λ²μ μΌλ‘ λ³κ²½νλ€.
-
vs codeμ typescript λ²μ μ λ§μΆ° node_modulesμ μ€μΉλ typescript λ²μ μ λ€μ΄κ·Έλ μ΄λ νλ©΄ λλ€.
4.1.2 λΌκ³ νμλ λΆλΆμ΄ vs codeμμ μ¬μ©μ€μΈ TypeScriptμ version μ΄λ€.
4.0.0 breaks with typescript (all versions) Β· Issue #9868 Β· facebook/create-react-app
μλ λ§ν¬μ μνλ©΄ ν΄λΉ μλ¬λ
eslint-import-resolver-node
λͺ¨λμ λΆμ¬ λλ¬Έμ μκΈ΄κ±°λΌκ³ νλ€.npm i eslint-import-resolver-node
λ₯Ό μ λ ₯ν΄ μ€μΉνλλ‘ νλ€.SyntaxError: pragma and pragmaFrag cannot be set when runtime is automatic.
Resolve error: unable to load resolver "node" Β· Issue #1730 Β· airbnb/javascript
-
μλ₯Ό ν΅ν΄ λ¬Έμ λ₯Ό ν΄κ²°νλλ λ€μκ³Ό κ°μ λ¬Έμ κ° λ°μνλ€.
Type '{ children: string; css: SerializedStyles; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLD Property 'css' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'. TS2322
-
ν΄κ²°λ°©μ
μλ λ§ν¬μ μνλ©΄ Emotion 11 λ²μ μ μ¬μ©ν κ²½μ° tsconfigμ μλ μ΅μ μ μΆκ°ν΄μΌνλ€κ³ νλ€.
{ " compilerOptions " : { " types " : [ " @ emotion / react / types / css-prop " ] } }
TS2322: Property 'css' does not exist... Β· Issue #1249 Β· emotion-js/emotion