https://github.com/vicsolwang/webpack-base-cli
Use webpack to build project
https://github.com/vicsolwang/webpack-base-cli
cli webpack
Last synced: about 1 year ago
JSON representation
Use webpack to build project
- Host: GitHub
- URL: https://github.com/vicsolwang/webpack-base-cli
- Owner: VicSolWang
- License: mit
- Created: 2020-01-22T05:33:39.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-17T01:35:45.000Z (over 6 years ago)
- Last Synced: 2024-12-20T00:33:58.490Z (over 1 year ago)
- Topics: cli, webpack
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/webpack-base-cli
- Size: 43.9 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webpack-base-cli
[](https://www.npmjs.com/package/webpack-base-cli)
[](https://nodejs.org)
[](https://travis-ci.com/VicSolWang/webpack-base-cli)
[](https://codecov.io/gh/VicSolWang/webpack-base-cli)
[](https://www.npmjs.com/package/webpack-base-cli)
Use webpack to build project
# Installation
npm install --save-dev webpack-base-cli
# Usage
webpack-base-cli build [options]
## Command options
-p, --prod Set production environment [boolean] [default: false]
-c, --config Set webpack config [string]
-v, --version Show version number
-h, --help Show help
### Example
webpack-base-cli build -p true -c config.js
#### Description
Default configuration is recommended, including config.js, babel.config.js, postcss.config.js, browserslist.js and other files. You can also configure these files by yourself, provided they are placed in the root directory of your project.
The default configuration of config.js is roughly as follows:
const path = require('path');
const config = {
path: {
src: path.resolve(process.cwd(), 'src'),
dev: path.resolve(process.cwd(), 'dev'),
prod: path.resolve(process.cwd(), 'output'),
devPublicPath: '/',
prodPublicPath: '',
},
devServerPort: 8888,
backEndServer: '',
hash: '-[hash:6]',
chunkhash: '-[chunkhash:6]',
contenthash: '-[contenthash:6]',
supportNewAPI: true,
imageCompress: true,
html: [{
name: 'index.html',
path: path.resolve(process.cwd(), 'src/index.html'),
}],
entry: {
index: [path.resolve(process.cwd(), 'src/index.js')]
},
favicon: path.resolve(process.cwd(), 'src/favicon.ico'),
};
Note: generally speaking, you only need to configure path.prodPublicPath and backEndServer in your own config.js.
# License
[MIT](LICENSE).