Questions tagged [create-react-app]

create-react-app is a starter-kit for creating React applications with no build configuration. If you’re getting started with React, use this to automate the build of your application. There isn't any configuration file, and react-scripts is the only extra build dependency in your package.json file. Your environment will have everything you need to build a modern React application.

Getting Started

5893 questions
3
votes
1 answer

Testcafe doesn't recognize my DOM in react

I'm new into testcafe, and trying to run a simple test on a client which made by create-react-app, but for some reason, I can't reach the DOM, and use the react selectors. My client: import Button from '@material-ui/core/Button' function(App){ …
3
votes
3 answers

How to get Web.config file in the root of a create-react-app project to copy to the build folder so it gets archived and deployed

I have a file copy task in my build to copy the Web.config in the root of my create-react-app project folder, and it shows that it is copying it to the build file after the yarn build task completes. But it is never in the archived folder. How do…
user1368182
  • 423
  • 7
  • 18
3
votes
2 answers

Bitbucket pipeline - build Create-react-app, zip it, upload it via ftp and unzip it on server

I'm using a bitbucket pipeline to deploy my react application. Right now my pipeline looks like this: image: node:10.15.3 pipelines: default: - step: name: Build script: - npm cache clean --force - rm…
3
votes
1 answer

After ejecting create-react-app to update packages, "webpack is not a function"

Using an older version create-react-app on an experimental boilerplate project, I needed to update the packages to proceed. I thought the best way to do this was to eject the create-react-app, but now the whole thing won't run. This is the output…
Gabriel Kunkel
  • 2,643
  • 5
  • 25
  • 47
3
votes
0 answers

Flow module.name_mapper not working for aliases in Create React App

I am trying to include the aliases from my webpack.config.js file in mt .flowconfig file, but I am still getting the "Can't resolve module" error. webpack.config.js: const path = require('path'); module.exports = config => { …
3
votes
1 answer

Eslint is not working in my react application

I am trying to add eslint to my typescript create-react-app application. I am using Visual Studio Code. I did : Download Eslint package in visual code Download Eslint package I installed 3 eslint plugin "eslint:recommended", …
Bobby
  • 4,372
  • 8
  • 47
  • 103
3
votes
2 answers

React app: Jest encountered an unexpected token

I try to test my app created via create-react-app. There is only one test file generated automatically: import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; it('renders without crashing', () => { const div =…
Nikita Ryanov
  • 1,520
  • 3
  • 17
  • 34
3
votes
1 answer

Uncaught SyntaxError: Unexpected token '<' in main.546ac9e6.chunk.js:1

We have this web app that is built using create-react-app and was deployed. Now we get this error in our console. Uncaught SyntaxError: Unexpected token '<' Most of the answers on StackOverflow speaks of webpack and all. We aren't using a…
kolaveri
  • 59
  • 1
  • 2
  • 15
3
votes
2 answers

Styling SVG as a React Component

Following the create-react-app doc, I imported a svg as a react component. However, I can't seem to resize or position it properly, whether it's inline or through css. I want to scale the SVG component to the same size as my other icon of 100px by…
Terry
  • 149
  • 1
  • 3
  • 12
3
votes
1 answer

Unable to stop SASS from evaluating contents of calc() css property

I created a fresh copy of CRA, just to make sure it wasn't something custom in my code, I have nothing except one sass file, which the following code: .test { top: calc((0% - (100% - 1.2em)) - 16%); } When I'm running development mode, the line…
Amir
  • 4,211
  • 4
  • 23
  • 41
3
votes
1 answer

How do i cache api in reactjs Progressive Web App(Pwa) to add Offline support?

I have registered my service worker by adding serviceWorker.register(); in my code.In create-react-app Api results are not cached.How do we cache Api result so we counld improve Offline support.
3
votes
2 answers

React SVG component render dynamically

I'm building a local weather app on React via Create React App and I need to render weather icon dynamically based on a type of weather. I have this code: import React from 'react'; import { ReactComponent as MistIcon } from…
Natalia Davydova
  • 728
  • 7
  • 22
3
votes
2 answers

How can I divide prod and dev version in create-react-app

I have an application on the react, when the build I want insert another path, how can this be done? I have two files with paths that need to be…
3
votes
0 answers

How to play offline videos in a progressive webapp using create react scripts

I created a fun progressive web app to play video tracks from our database and has a nifty download button on the tracks so they can be played offline. Trouble is that when the webapp is actually offline, the cached version of the track isn't being…
3
votes
0 answers

Invalid Hook Call in shared module using react-spring

I have a create react app that uses a shared module via customize-cra and I am attempting to use react-spring within this common module. I am unfortunately getting the dreaded Invalid Hook Call notification: Invalid hook call. Hooks can only be…
Nick Palmer
  • 2,589
  • 1
  • 25
  • 34