free-ground-cli
v1.0.9
Published
集成了 webpack, webpack-dev-server, html-webpack-plugin, 适用于想简单打包, 却不想每次都配置的情况
Downloads
3
Readme
🍦free-ground-cli v1.0.9
集成了 webpack, webpack-dev-server, html-webpack-plugin, 适用于想简单打包, 却不想每次都配置的情况
安装
npm i free-ground-cli --save-dev
或
yarn add free-ground-cli --save-dev
使用
执行 webpack 打包:
npx free
执行 webpack-dev-server 服务:
npx free dev
或者在 package.json 中配置
...
"scripts": {
"start": "free dev",
"build": "free"
},
...
然后执行
npm start
npm run build
默认配置
默认入口 src/index.js, 输出 ./dist, html 模板 src/document.ejs
// webpack.config.js
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
mode: "development",
entry: {
index: "./src/index.js",
},
plugins: [
new HtmlWebpackPlugin({
template: "./src/document.ejs",
}),
],
devServer: {
static: "./dist",
hot: true,
},
output: {
filename: "[name].bundle.js",
path: path.resolve("./dist"),
},
};