npm i @mini-code/env-scripts --dev
# or
yarn add @mini-code/env-scripts -D
{
"scripts": "minictl start"
}
在工程目录创建 .mini-scripts-config.js
module.exports = {
paths: {
"srcDir": "src",
"appIndexJs": "index",
"appBuildDir": "dist",
"appHtml": "public/index.html",
"deployHtml": "public/deploy.html"
},
// 给 devServer 的 options
devServerOptions: {},
// webpack 的 options
// 覆盖默认提供的 webpack config
webpackConfig: {
output: {
publicPath: './'
},
externals: {
react: 'React'
}
},
// 完全替代默认的 webpack 配置
webpackConfigRaw: {},
preRun: () => {
// 启动前生命周期函数
}
}