Questions tagged [react-scripts]

Package containing various scripts for running applications created via create-react-app

Package containing various scripts for running applications created via create-react-app

501 questions
7
votes
1 answer

When running npm test, is it necessary to place "CI=true" in the beginning of the test command?

My package.json contains "scripts": { "test": "CI=true react-scripts test --env=jsdom" } What is the difference if I rewrite the code as "scripts": { "test": "react-scripts test --env=jsdom CI=true" } Will the…
7
votes
1 answer

Optional-Chaining does not work in create-react-app

In a create-react-app project, I am using @babel/plugin-proposal-optional-chaining in my `.babelrc However, I have this error: Module parse failed: Unexpected token (22:16) You may need an appropriate loader to handle this file type. This is all my…
Dimitri Kopriwa
  • 13,139
  • 27
  • 98
  • 204
7
votes
1 answer

Is there a way to let webpack dev server use another port?

I'm using the webpack dev server, via the react scripts and I'd like to use the debugging functionality it offers via Visual Studio Code, however, I have a non-standard setup. We have service in front of the webpack dev server that proxies all…
Alex
  • 2,953
  • 1
  • 27
  • 37
7
votes
1 answer

React homepage attribute not working

In my package.json file I have "homepage" : "http://myname.project.com/myapp", I build the app using npm run build and the output confirms that a /build directory was created. Output: 102.97 KB build/static/js/main.bfa46b52.js 24.37 KB …
user1521567
  • 1,743
  • 3
  • 21
  • 31
7
votes
1 answer

Is there a way to have `react-scripts` include extra files in the root of the build?

My Situation: I'm hosting an app created with create-react-app on Surge. In order to have Surge let react-router handle the routes, I have to add a 200.html to the root, and in order to handle 404s, I have to add a 404.html to the root. The problem…
Jo Sprague
  • 16,523
  • 10
  • 42
  • 62
6
votes
1 answer

(Create-React-App) Module not found: You attempted to import /node_modules/console-browserify/index.js which falls outside of the project

Recently upgraded to version 5.0.1 of react-scripts and in doing that I needed to re-add support for Node.js core modules by importing NodePolyfillPlugin into my react-scripts config and adding it to plugins. That did resolve the errors I was seeing…
aus_10
  • 141
  • 2
  • 8
6
votes
1 answer

Why is my react-scripts build throwing an error with the SourceMapConsumer?

I am building an app in Ionic/react, and up until this point it has functioned normally. I ran into an error with the FFI architecture in Ruby, and ran a brew install ruby, exported the path, and reinstalled cocoapods with brew. Since then, my…
6
votes
0 answers

Do i need to upgrade react-scripts while upgrading from React 17 to React 18

I have a react application using the react version 17.0.2 and react-scripts version 4.0.3 I updated my react version to 18 but i didn't updated my react-scripts. Is this a right approach? Do i really need to upgrade react-scripts as well to…
6
votes
1 answer

'BUILD_PATH' is not recognized as an internal or external command

I want to run a backend server along with frontend on same server. So I build the frontend and provided a build path but this is not working. Here is my npm script file. { "name": "nasa-fe", "version": "1.0.0", "private": true, …
Faizanur Rahman
  • 474
  • 3
  • 12
6
votes
4 answers

React build - not found: Error: Can't resolve 'buffer'

I am having an error when I build my application in react. I noticed this error only when I tried to build application. When I stopped dev server and ran it again, it showed the same error. It seems that I made some change that only showed when I…
Mario Petrovic
  • 7,500
  • 14
  • 42
  • 62
6
votes
0 answers

React-scripts@4 Failed to compile because of prettier

Updated react-scripts from 3 to 4.0.1 with all underlying packages (react@17, typescript@4.1 and eslint@7.14), now it shows Failed to compile. in the console with tons of prettier problems like they are errors. Used to run fine before, showing only…
6
votes
1 answer

Can I use relative path with webpack dev server - react js

When I run a development server on localhost:3000 using npm run start, the server works as expected. I am using react-scripts, I have not ejected the react app. What I am trying to do, is set up the dev server behind a reverse proxy. So…
6
votes
2 answers

How to make yarn start work inside Docker image with react-scripts 3.4 and babel-loader 8.1?

I'm building a Docker image for debugging of my React application with a separate Dockerfile FROM node:11-alpine COPY package.json . COPY yarn.lock . RUN yarn install COPY public/ ./public/ COPY src/ ./src/ EXPOSE 3000 CMD yarn run start with…
Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
6
votes
3 answers

How to run one 'npm start' for two different folders in my project directory

I would like to run one npm start command to run both my frontend folder and backend folder. Currently, I have to navigate inside each folder and individually run the command on both to see my app open on the localhost. I have looked into the…
Jschriemer
  • 625
  • 1
  • 7
  • 23
6
votes
1 answer

Loading multiple react apps on the same page, override webpack output jsonpFunction in react-scripts

I have a main react app in which based on a selected service, I'm dynamically loading another react app to a second root. The second app I'm loading is bundled using the webpack.config below... const path = require("path") const UglifyJsPlugin =…
James Morrison
  • 1,954
  • 2
  • 21
  • 48