@wz-libs/rc-service
v1.0.7
Published
react + webpack5
Downloads
6
Maintainers
Readme
React Start or build
Environment
- node v12.13.0+
- webpack v5.38+
- webpack-cli v4.9+
- webpack-dev-server v4.7+
1、Git clones use projects
git clone https://gitee.com/my_domain/rc-react-project.git
cd rc-react-project
yarn
yarn start
2、Replace to use
Install
npm install @wz-libs/rc-service -D
or
yarn add @wz-libs/rc-service -D
command
command | explain | remark --- | --- | --- start | The development environment runs commands | yarn start / npm run start build | The production environment runs commands | yarn build / npm run build analyse --development | Development environment performance analysis | yarn analyse --development / npm run analyse --development analyse --production | Production environment performance analysis | yarn analyse --production / npm run analyse --production
command extend
## Note: if APP_ENV is not set and exists, the. Env file will be loaded by default
Read environment variables from files .env.[APP_ENV]
Example: npm run start -m dev
npm run start -m [APP_ENV] Or npm run start --mode [APP_ENV]
npm run build -m [APP_ENV] Or npm run build --mode [APP_ENV]
directory
├── public // Static resource file
│ ├── index.html // index.html
├── src // Important folder
│ ├── index.js // React run and webpack compile entry file The must
│ ├── App.js // Render route page
│ ├── pages // React pages
│ ├── assets // assets
├── .env/.env.[APP_ENV] // Environment Variable Configuration
├── rcw.config.js // custom webpack config
├── .babelrc // babel config
├── package.json // package.json
rcw.config.js
### The global environment variable NODE_ENV is the built-in variable
const { merge } = require('webpack-merge')
module.exports = {
webpackConfig: (config,isDev, APP_ENV) => {
return merge(config, {
// your webpack config
});
}
}
package.json
"scripts": {
"start": "rc-service start", // The development of start
"build": "rc-service build", // The deployment of building
"analyse:dev": "rc-service analyse --development", // Development environment performance analysis
"analyse:prod": "rc-service analyse --production" // Production environment performance analysis
},
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.2.1"
},
"devDependencies": {
"@wz-libs/rc-service": "^1.0.0"
}