create-react-app

How does react-create-app/react-scripts find the entry point?

荒凉一梦 提交于 2021-01-18 05:30:24
问题 In this tutorial, how does npm start find the src/index/js to star the render? I can't find the configuration of this anywhere. 回答1: you can run npm run eject so that the project turn back to a normal webpack project. then you can find the configs. 回答2: while running npm run eject, you can find a config folder with all configuration files. Inside path.js file you can find the default path and if want you can change the default path there. Be careful while doing this since it is an

How does react-create-app/react-scripts find the entry point?

本小妞迷上赌 提交于 2021-01-18 05:30:06
问题 In this tutorial, how does npm start find the src/index/js to star the render? I can't find the configuration of this anywhere. 回答1: you can run npm run eject so that the project turn back to a normal webpack project. then you can find the configs. 回答2: while running npm run eject, you can find a config folder with all configuration files. Inside path.js file you can find the default path and if want you can change the default path there. Be careful while doing this since it is an

Tailwind in React project - getting “Cannot find module 'autoprefixer'” error during setup

岁酱吖の 提交于 2021-01-05 07:08:38
问题 I'm following the documentation for setting up Tailwind in a React project over on https://tailwindcss.com/docs/guides/create-react-app. I've been following the steps, but when I get to the part where I'm supposed to run npx tailwindcss init in order to generate a tailwind.config.js file, I get the following error: Cannot find module 'autoprefixer' Require stack: - C:\Users\[user]\AppData\Roaming\npm-cache\_npx\16096\node_modules\tailwindcss\lib\cli\commands\build.js - C:\Users\[user]\AppData

Tailwind in React project - getting “Cannot find module 'autoprefixer'” error during setup

蓝咒 提交于 2021-01-05 07:04:30
问题 I'm following the documentation for setting up Tailwind in a React project over on https://tailwindcss.com/docs/guides/create-react-app. I've been following the steps, but when I get to the part where I'm supposed to run npx tailwindcss init in order to generate a tailwind.config.js file, I get the following error: Cannot find module 'autoprefixer' Require stack: - C:\Users\[user]\AppData\Roaming\npm-cache\_npx\16096\node_modules\tailwindcss\lib\cli\commands\build.js - C:\Users\[user]\AppData

ESLint error - ESLint couldn't find the config “react-app”

假装没事ソ 提交于 2021-01-03 06:43:13
问题 Me with my team, start a new React Project using the create-react-app bootstrap command. We add the eslint section on the project but we stuck with annoying error that we never found it before now. When we launch the command yarn run lint Here the error: Here the package.json: { "name": "name of the app", "version": "0.1.0", "private": true, "dependencies": { "jwt-decode": "^2.2.0", "react": "^16.12.0", "react-dom": "^16.12.0", "react-intl": "^3.12.0", "react-router": "^5.1.2", "react-router

Uncaught SyntaxError: Unexpected token export

喜你入骨 提交于 2021-01-02 05:24:51
问题 I have used create-react-app for my project. I am getting an error of Uncaught SyntaxError: Unexpected token export The error is in this code export const ENGLISH = { lang: 'en', messages: { 'nav.translatedMessage': 'Social', } }; I tried installing babel-preset-es2015 and babel-preset-stage-0. Also i included the babel dict/object in package.json as "babel": { "presets": [ "es2015", "stage-0" ] }, I am still getting an error. 回答1: I got my answer on README.md of create-react-app. There it

React (CRA) SW Cache “public” folder

大憨熊 提交于 2020-12-30 05:34:05
问题 After executing the create-react-app and enabling the service workers in the index.js , all relevant files from the src folder are cached. However some of my resources reside in the public directory. When I run npm run build , the asset-manifest.json and precache-manifest.HASH.js only contain the HTML, mangled JS and CSS (all stuff from the src folder). How can I tell the service worker to additionally cache specific files from the public folder? Here is the actually generated precache

“ReferenceError: document is not defined” when trying to test a create-react-app project

醉酒当歌 提交于 2020-12-29 08:50:08
问题 This is my __tests__/App.js file: import React from 'react'; import ReactDOM from 'react-dom'; import App from '../src/containers/App'; it('renders without crashing', () => { const div = document.createElement('div'); ReactDOM.render(<App />, div); }); // sanity check it('one is one', () => { expect(1).toEqual(1) }); And this is the output I get when running yarn test : FAIL __tests__/App.js ● renders without crashing ReferenceError: document is not defined at Object.<anonymous>.it (__tests__

Create React App V2 - Multiple entry points

心已入冬 提交于 2020-12-29 03:50:21
问题 I'm trying to build a React app with 2 entry points, one for the App and one for the Admin panel. I'm starting with Create React App V2 and following this gitHub issue thread https://github.com/facebook/create-react-app/issues/1084 and this tutorial http://imshuai.com/create-react-app-multiple-entry-points/. I'm trying to port the instructions for adding multiple entry points from CRA V1 to work in V2 but I think I am missing something. After ejecting CRA, these are the paths I've changed

Create React App V2 - Multiple entry points

荒凉一梦 提交于 2020-12-29 03:49:11
问题 I'm trying to build a React app with 2 entry points, one for the App and one for the Admin panel. I'm starting with Create React App V2 and following this gitHub issue thread https://github.com/facebook/create-react-app/issues/1084 and this tutorial http://imshuai.com/create-react-app-multiple-entry-points/. I'm trying to port the instructions for adding multiple entry points from CRA V1 to work in V2 but I think I am missing something. After ejecting CRA, these are the paths I've changed