天道酬勤,学无止境

create-react-app

create-react-app typescript won't run npm start

I am trying to create-react-app with typescript, but there seems to be a problem with JSX and TS. I read a couple of possible solutions, that didn't work out for me. I have: npm: version 16.14.7 node: version 14.8.0 I used npx create-react-app my-app --template typescript from the docs The installation went fine, but when I try to run npm start it gives me this error: > my-app@0.1.0 start /Users/lukasbenediktson/Desktop/react-types/my-app > react-scripts start /Users/lukasbenediktson/Desktop/react-types/my-app/node_modules/react-scripts/scripts/utils/verifyTypeScriptSetup.js:239 appTsConfig

2022-01-18 09:58:08    分类:问答    reactjs   typescript   create-react-app   react-tsx   react-typescript

Add flow to compilation step on create-react-app project

I'm working on a project with create-react-app and would like to add Flow to my process. The official documentation explains how to do this and it's relatively straightforward, but following their instructions it adds it alongside the built in linting/building/compilation that the app does on its own. Based on my understanding, any time I save or make a change to my application code, ESLint is running a style check on my code, Babel is transpiling my ES6 to ES5 JavaScript, and my JSX is being transpiled into JS. I would simply like to add Flow typechecking to that process. How can I configure

2022-01-18 02:44:47    分类:问答    webpack   eslint   babeljs   flowtype   create-react-app

Can not create app using create-react-app

When I try to create an app using create-react-app that give an error error eslint@5.6.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". error Found incompatible module info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. My node version is 8.9.3 My NPM version is 6.4.1 My create-react-app version is 1.5.2 The project cannot create given error are display.

2022-01-17 06:32:42    分类:问答    reactjs   npm   command-line-interface   create-react-app

Why is my react project crashing when updating from react-scripts 3.2.0 to 3.3.0?

I updated my react project using npm install --save --save-exact react-scripts@3.3.0 But when I start my react project I get this... Starting the development server... <--- Last few GCs ---> [27403:0x108000000] 53085 ms: Scavenge 2041.3 (2049.1) -> 2040.6 (2049.4) MB, 7.8 / 0.0 ms (average mu = 0.242, current mu = 0.164) allocation failure [27403:0x108000000] 53094 ms: Scavenge 2041.8 (2049.9) -> 2041.2 (2050.1) MB, 7.7 / 0.0 ms (average mu = 0.242, current mu = 0.164) allocation failure [27403:0x108000000] 53101 ms: Scavenge 2042.0 (2050.1) -> 2041.3 (2050.6) MB, 5.2 / 0.0 ms (average mu = 0

2022-01-17 06:20:36    分类:问答    reactjs   create-react-app

How can i fix @fontface issue in my react application?

I am facing an issue with custom fonts. I have created an app using create-react-app and provided the custom font files (.ttf) in public folder so that while building the app, all assests are part of the build. I am able to see the font on my local but not on nginx server. Nginx server has the .ttf support since another application is working fine. What should be the miss? I am not able to find it. Also, firefox is not able to load the same custom font. Here is my stylesheet - @font-face { font-family: 'Simplied'; src: url('/fonts/simplied-Light.ttf') format('truetype'); } which i import in

2022-01-16 23:45:27    分类:问答    css   reactjs   create-react-app   font-face

Starting a react app in HTTPS instead of HTTP

I want to know how to start a react app which was made using the create-react-app command in https instead of HTTP?

2022-01-16 17:05:12    分类:问答    reactjs   create-react-app

React global component

I am coming from a vue.js background and I have just recently started looking into react. I have a component: PageContent.jsx and I wish to use it without constantly having to import it to be able to use it inside the render function (JSX). In vue it is possible to globalise a component using: Vue.component(componentName, componentObject) Is there anything similar in react?

2022-01-16 16:04:20    分类:问答    javascript   reactjs   components   create-react-app

如何将 WebAssembly (wasm) 与 create-react-app 一起使用(How to use WebAssembly (wasm) with create-react-app)

问题 我使用create-react-app和带有wasm的库,它称为 sax-wasm。 稍微修改网络的示例代码我得到了这个: import { SaxEventType, SAXParser } from 'sax-wasm'; async function loadAndPrepareWasm() { const saxWasmResponse = await import('sax-wasm/lib/sax-wasm.wasm'); const saxWasmbuffer = await saxWasmResponse.arrayBuffer(); const parser = new SAXParser(SaxEventType.Attribute | SaxEventType.OpenTag, { highWaterMark: 64 * 1024, }); const ready = await parser.prepareWasm(new Uint8Array(saxWasmbuffer)); if (ready) { return parser; } } loadAndPrepareWasm().then(console.log); 当我运行yarn start命令时,我的构建失败: Failed to compile. ./node_modules/sax

2022-01-16 08:42:40    分类:技术分享    webpack   create-react-app   webassembly

Heroku create-react-app deploy Uncaught SyntaxError: Unexpected token(Heroku create-react-app deploy Uncaught SyntaxError: Unexpected token <)

问题 每当我使用 create-react-app buildpack 部署我的 heroku 应用程序时,我第一次尝试访问我的域时,加载的页面是白色的,并且开发人员控制台中出现错误提示 Uncaught SyntaxError: Unexpected token < 在由 react 构建生成的文件main.6396d38a.js:1中。 但是,当我刷新页面时,该网站运行良好。 这有可能发生的原因吗? 我尝试使用npm run build和serve -s build在我的localhost上复制错误,但我的网站在那里工作得很好。 为什么每次反应部署到heroku后这只会出现一次? 我的 package.json 有一个与我网站的域名相关联的主页(不是 .herokuapp.com) "homepage": "https://www.example.com/" 回答1 在你的package.json确保你的homepage URL 是正确的: "homepage": "https://app.herokuapp.com/" 更新 进一步调查表明这是一个缓存问题。 清除 cookie、网站内容和 DNS 解决了这个问题。

2022-01-16 06:03:12    分类:技术分享    reactjs   typescript   heroku   create-react-app