Blank page after running build on create-react-app
I solved the problem by setting “homepage”: “.” in package.json according to this doc
I solved the problem by setting “homepage”: “.” in package.json according to this doc
I have something similar happening to me. I have a react project that I want to convert to Typescript and I started as you noted with the “create-react-app”, added all my files and hoped for the best – but got stuck like you on the “Starting the development server” message. I have an 8GB Ram … Read more
Applying this change: ‘/service-worker.js’ // ❌ ‘./service-worker.js’ // ✅ fixed my issue. (in navigator.serviceWorker.register(‘/service-worker.js’)) Or maybe you need: ‘%PUBLIC_URL%/serviceworker.js’ Thank @DanielLord for his comment.
In addition to your requirements, I am adding mine: It should be done by CD, through an env variable. If I need to rename the subdirectory, I should only have to change the env variable. It should work with react-router. It should work with scss (sass) and html. Everything should work normally in dev mode … Read more
If you’re here because of react v18, and you want to go down to the previous non-change breaking version, here’s what i did: in your package.json replace: “react”: “^18.0.0” “react-dom”: “^18.0.0” with “react”: “^17.0.2” “react-dom”: “^17.0.2” Then go to your entry file index.js At the top, replace: import ReactDOM from ‘react-dom/client’ with import ReactDOM from … Read more
It seems to be correct behaviour in create-react-app according to Issue #1632. Gaeron: This is expected. You can delete .map files from the build output if you want to disable it, although you’ll get console warnings about them missing. There is no harm in leaving them in though in my opinion. Client code is already … Read more
I was able to do this by using advice from this issue. Put the configuration options react scripts likes to remove in a separate file (e.g. paths.json) and reference it from tsconfig.json via the extends directive. paths.json: { “compilerOptions”: { “baseUrl”: “./src”, “paths”: { “interfaces/*”: [ “common/interfaces/*”], “components/*”: [ “common/components/*”], } } } tsconfig.json { … Read more
I just tried with an (almost) new CRA setup and it works. <head> <title>React App</title> <script type=”text/javascript”> console.log(“%REACT_APP_TEST%”) // OK console.log(“%NODE_ENV%”) // development </script> </head> Did you try restarting the server? I just tried changing the test variable with your example and it works if you restart the development server. As someone pointed out in … Read more
This is because VSCode’s Typescript version is not using the newest babel features that create-react-app uses by default. You can change VS Code to use the workspace’s version of Typescript instead, which will fix this issue. Open a TypeScript or JavaScript file and click on the TypeScript version number in the Status Bar. A message … Read more
Add it to your test case file. import React from ‘react’; import Adapter from ‘enzyme-adapter-react-16’; import { shallow, configure } from ‘enzyme’; configure({adapter: new Adapter()}); test(‘message box’, ()=> { … })