144得票1回答
Create-React-App应用程序中index.html和index.js之间的连接在哪里?

我开始使用Create React App进行编程,但是我无法理解index.js如何在index.html中加载。以下是HTML代码: <!doctype html> <html lang="en"> <head> &lt...

144得票35回答
create-react-app 的开发服务器不会自动刷新

我正在使用create-react-app跟随一个React的教程。应用程序由create-react-appv1.3.0创建。create-react-app my-app 开发服务器由运行npm start 经过多次修改代码后,浏览器未能实时更新/热加载更改。刷新浏览器也没有帮助。只有停止...

143得票12回答
tslint说不允许调用console.log - 我该如何允许它?

我刚开始使用 TypeScript 创建 React 应用程序create-react-app my-app --scripts-version=react-scripts-ts 默认的tslint.json配置不允许console.log()。 我现在怎样才能启用console.log()...

142得票5回答
当我运行jest测试时,是否有选项可以显示所有测试描述?

我正在使用jest和enzyme与我的create-react-app项目。当我运行npm test时,我会得到一个输出,显示通过的测试文件的名称,但我希望输出还包括测试的名称。 示例: Button.test.js it ('renders button', () => { ...

141得票42回答
自从 4.0.1 版本以来,create-react-app 工具无法运行。

我尝试使用npm i create-react-app、npx create-react-app new-app和npm init react-app new-app安装create-react-app,但我一直收到以下错误信息: 您正在运行create-react-app 4.0.0,落后...

138得票3回答
在非交互模式下运行 CRA Jest

更新:我的应用场景主要是在CI上运行测试,但覆盖默认的 CRA Jest 参数是我普遍关心的问题。 我正在使用随Create React App一起提供的Jest配置来运行测试。它总是进入交互模式: › Press a to run all tests. › Press o to on...

129得票13回答
无法使用自定义PUBLIC_URL构建create-react-app项目

我正在尝试PUBLIC_URL=http://example.com npm run build 使用最新的create-react-script构建的项目。然而,在public/index.html中出现的%PUBLIC_URL%被替换为一个空字符串,而不是预期的值PUBLIC_URL。pu...

127得票25回答
create-react-app: 如何使用https而非http?

我想知道有没有人知道如何在“create-react-app”环境中使用https。我在README或快速谷歌搜索中找不到任何相关信息。我只想让https://localhost:3000正常工作,否则就是https://localhost:3001。

124得票11回答
禁用create-react-app提供的ESLint

create-react-app v3.0.0已经发布,它内部支持TypeScript的linting(挺不错的!)。我认为我理解了启用TSLint的情况,并计划将其替换为ESLint,但目前还没有做到。 如何在react-scripts start中禁用linting步骤? /* eslin...

121得票7回答
构建后index.html中的相对路径

你好,我有一个ReactJS应用程序,并使用以下命令构建我的项目: npm build 这是我的package.json文件: "scripts": { "start": "react-scripts start", "build": "react-scripts ...