Skip to content

Tag: create-react-app

Is eslint pre-commit hook in CRA bootstrapped application required?

My react application is bootstrapped using CRA(react-scripts v4.0.0) and I want to add a code formatter (prettier to be specific) that must format the code before committing the changes to my git repo. I know that eslint is a dependency of react-scripts and linting is done using ‘eslint-webpack-plugin'(default enabled) inside the webpack configuration. Snippet from CRA github | React Scripts

When importing a module from node_modules that uses route based lazy loading in create-react-app, should code splitting work in the same way?

I used create-react-app (react ^17.0.2, react-scripts 4.0.3) to knock up a simple application which uses route based lazy loading to perform code splitting. When I build this application I see separate chunks created per lazy loaded component and this all works fine as all my components are exported using default. My output is: I then updated my package.json file to

Changing Background image using Create React App

Having trouble using Create React App to change a background image I feed to my component through props. The docs say use the import syntax. This works but it would mean I have to hard code every background image to each component. Anyway to do this dynamically? I noticed it won’t let me use template literals on the import syntax

Ignoring specific file path during Format.Js message extraction

When using Create React App and TypeScript, a file is auto-generated in the src directory: react-app-env.d.ts. This file seems necessary to support image imports as discussed here: When using Format.JS, I extract messages using the following command: But unfortunately this results in this error: I need to process both .ts and .tsx files. I have tried to hack the