2024-03-18.10.32.47_C.1.1.mp4
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Before run npm run build
, Please see dll-related information below first.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
If you do not need dll vendor chunk, you should delete dll-related configuration in file webpack.rewire.js
,
delete file ./src/utils/webpack.dll.js
, delete build:dll
script in package.json
,and remove related packages.
NOTICE!!, if you update any dll-packed package version, do not forget to re-run build:dll
script.
prettier
is initially supported. if shortcut not valid, please check your IDE setting.
When executing git commit
, it would automatically format your changed/staged files.
Command + left click
the module path does not navigate to the right file in WebStorm?
try coding assistance
You can create an arbitrary build environment by creating a custom .env file and loading it using env-cmd.
https://create-react-app.dev/docs/deployment/#customizing-environment-variables-for-arbitrary-build-environments
.env
. .env.development
. .env.production
...
https://create-react-app.dev/docs/adding-custom-environment-variables/.
https://create-react-app.dev/docs/advanced-configuration/.
- webpack-bundle-analyzer
yarn bulid analyze
ornpm run build analyze
- Or the official recommended way --> Analyzing the Bundle Size
yarn add antd
or npm install antd --save
.
- Modularized antd
yarn add babel-plugin-import
ornpm install babel-plugin-import --save
.- In
webpack.rewire.js
, uncomment below code inwebpack.rewire.js
:
babelOptions.plugins.push([ require.resolve('babel-plugin-import'), { libraryName: 'antd', libraryDirectory: 'es', style: true }, ])
- antd Customizing Theme,
less-loader
->modifyVars
- Customizing theme require
less
support, first installing related dependencies:less
,less-loader
, and uncommenting code related toless
configuration inwebpack.rewire.js
- Customizing theme require
yarn add lodash
or npm install lodash --save
.
Recommend importing function through full module path, eg: import debounce from 'lodash/debounce'
.
- Install related dependencies.
$ npm install lodash-webpack-plugin babel-plugin-lodash --save $ # or $ yarn add lodash-webpack-plugin babel-plugin-lodash
- In
webpack.rewire.js
file, trying to add the following code in the right place:// merged this plugin into webpack's property `plugins`. const LodashModuleReplacementPlugin = require('lodash-webpack-plugin') new LodashModuleReplacementPlugin() babelOptions.plugins.push([require.resolve('babel-plugin-lodash')])