create-react-app

How to trigger hot reloading for React when a package in node_modules is changed?

人走茶凉 提交于 2021-01-24 11:42:09
问题 I am building a React component library and additional documentation project. My goal is to display immediately all changes of the library straight into the documentation. So far I have configured webpack to watch for changes in the components. After rebuilding, I take the output folder and move it in the node_modules of the documentation. This way I can simulate using my component library as an external package. The documentation is a create-react-app project and by default it does not watch

Heroku create-react-app deploy Uncaught SyntaxError: Unexpected token <

被刻印的时光 ゝ 提交于 2021-01-24 11:15:28
问题 Whenever I deploy my heroku app with the create-react-app buildpack, the first time I try to access my domain, the page loaded is white and there is an error in the developer console saying Uncaught SyntaxError: Unexpected token < in the file main.6396d38a.js:1 which is generated by the react build. However, when I refresh the page, the website works perfectly fine. Is there a reason this could be happening? I tried to replicate the error on my localhost using npm run build , and serve -s

React - Internet explorer 11 input loses focus after first onchange

守給你的承諾、 提交于 2021-01-24 09:02:21
问题 I have come across a very strange issue that I can't wrap my head around. I'm currently working with an create-react-app using react 16.3 and Antd 3.11 framework and I have created a table which inside it's header column renders a component with an onChange event attached. The issue comes when I focus the input for the first time. I lose focus on first key event, and afterwards when I click the field again, it remains focused until I click something else. Here is the example I have been using

babel-preset-react-app not picking up environment variables

拈花ヽ惹草 提交于 2021-01-22 08:15:23
问题 Failed to compile ./src/index.js Module build failed: Error: Using babel-preset-react-app requires that you specify NODE_ENV or BABEL_ENV environment variables. Valid values are "development", "test", and "production". Instead, received: "undefined". (While processing preset:"C:\Users\mitch\OneDrive\Development\Git\react-seed\node_modules\babel-preset-react-app\index.js") at Array.map (native) I keep getting the above error no matter how many weird and wonderful ways I try to set either the

babel-preset-react-app not picking up environment variables

不问归期 提交于 2021-01-22 08:14:28
问题 Failed to compile ./src/index.js Module build failed: Error: Using babel-preset-react-app requires that you specify NODE_ENV or BABEL_ENV environment variables. Valid values are "development", "test", and "production". Instead, received: "undefined". (While processing preset:"C:\Users\mitch\OneDrive\Development\Git\react-seed\node_modules\babel-preset-react-app\index.js") at Array.map (native) I keep getting the above error no matter how many weird and wonderful ways I try to set either the

Add absolute paths to app created by “Create React App”

倾然丶 夕夏残阳落幕 提交于 2021-01-21 10:22:12
问题 I have created an app by Create React App and to be more specific I'm also using typescript. I can't figerout how to set absolute paths to access to my components, pages, etc.. In a different scenario I would update my tscongig with something like: { "compilerOptions": { "baseUrl": ".", "paths": { "@components/*": ["src/components/*"] } } } but I have no idea how to implement this as I'm using react-scripts any idea? 回答1: Create a tsconfig.json file and add the code below. { "compilerOptions"

Add absolute paths to app created by “Create React App”

家住魔仙堡 提交于 2021-01-21 10:22:10
问题 I have created an app by Create React App and to be more specific I'm also using typescript. I can't figerout how to set absolute paths to access to my components, pages, etc.. In a different scenario I would update my tscongig with something like: { "compilerOptions": { "baseUrl": ".", "paths": { "@components/*": ["src/components/*"] } } } but I have no idea how to implement this as I'm using react-scripts any idea? 回答1: Create a tsconfig.json file and add the code below. { "compilerOptions"

Problems with babel loader in react-create-app

泪湿孤枕 提交于 2021-01-21 06:24:44
问题 The Problem create-react-app initializes a repository where babel-loader is installed as an older version than needed. LOG: There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally. The react-scripts package provided by Create React App requires a dependency: "babel-loader": "8.0.4" Don't try to install it manually: your package manager does it automatically. However, a different version of babel-loader was

Get version number from package.json in React Redux (create-react-app)

大憨熊 提交于 2021-01-20 15:20:10
问题 OP EDIT: If anyone else comes across this: the app was created using create-react-app, which limits importing to within the src folder. However if you upgrade react-scripts to v1.0.11 it does let you access package.json. I'm trying to get the version number from package.json in my app. I've already tried these suggestions, but none of them have worked as I can't access package.json from outside the src folder (might be due to React, I'm new to this). Moving package.json into src then means I

Get version number from package.json in React Redux (create-react-app)

▼魔方 西西 提交于 2021-01-20 15:19:07
问题 OP EDIT: If anyone else comes across this: the app was created using create-react-app, which limits importing to within the src folder. However if you upgrade react-scripts to v1.0.11 it does let you access package.json. I'm trying to get the version number from package.json in my app. I've already tried these suggestions, but none of them have worked as I can't access package.json from outside the src folder (might be due to React, I'm new to this). Moving package.json into src then means I