@chaoswise/scaffold

1.1.6 • Public • Published

脚手架

打包工具

工具支持指令

开发环境

chaoswise-scripts dev

生产环境

chaoswise-scripts build

代码分析

chaoswise-scripts analyze

代码打包快捷指令(遵循CICD打包规范)

打包后路径为/publish/工程名-版本号-最后一次git提交日期-最后一次git提交commit记录

chaoswise-cicd

默认打包package.json字段的文件,也可以通过以下配置打包指定文件夹

outputPath=myPath chaoswise-cicd

扩展配置方式

1. 内置配置

// 修改config/webpack.config.js
module.exports = {
  themes: [
    {
      name: 'light',
      entryPath: path.resolve(__dirname, './themes/light.js')
    }, 
    {
      name: 'dark',
      entryPath: path.resolve(__dirname, './themes/dark.js')
    }
  ], // 多主题配置
  modifyVars: require.resolve('./themes/light.js'), // 单主题配置
}
可修改的配置 描述 默认值 备注
debugIe 是否开启ie调试模式 false
useMultipleTheme 是否开启多主题 false
runtimePublicPath 是否开启动态publicPath false 参考
publicPath publicPath '/' runtimePublicPath为false时生效
isNoticeUpdate 是否开启升级通知 true
speedMeasure 是否开启打包测速分析 false speed-measure-webpack-plugin
strictPathCheck 是否开启路径严格检测模式 true case-sensitive-paths-webpack-plugin,会延长打包时间,windows电脑无此问题可关闭
disableESLintPlugin 是否禁用eslint false
checkCircularDependency 是否开启循环依赖检测 true
nodePolyfillPlugin Polyfill Node.js core modules in Webpack true
prettierFixed 是否自动格式化代码 true
optimization 是否开启打包优化 true 需要线上部署进行debug可以关闭此配置(显示console/增加sourceMap等)
dropConsole build模式是否去除console true debug信息线上需要显示的时候
themes 多主题配置文件配置 [] 可参考以上demo,useMultipleTheme为true时生效
isCombinePortal 是否开启对接portal的配置 false 对接portal文档
modifyVars 单主题配置文件 - 可参考以上demo,useMultipleTheme为false时生效
usePolyfill 是否引入polyfill兼容ie true 不兼容ie可以配置为false
useChaoswiseUI 是否引入@chaoswise/ui相关配置 true
useThreadLoader 是否开启多线程编译 false

2. 自定义webpack配置

// 修改config/webpack.config.js
name/* 配置名称 */: (original/* 默认配置 */) => {
  console.log(original);
  // demo:修改默认配置
  original.port = "8802";
  // 必须返回修改后的配置
  return original;
}
可扩展的webpack配置
可修改的配置 描述
entry 入口
output 出口
resolve 配置如何解析模块
babelLoader babel解析规则
postcssLoader postcss-loader配置
styleLoader style-loader配置
lessLoader lessLoader配置
threadLoader threadLoader配置
sassLoader sassLoader配置
definePlugin 配置环境变量
miniCssExtractPlugin miniCssExtractPlugin配置
htmlPlugin 配置html-webpack-plugin
htmlTagsPlugin 指定要注入的脚本或者样式文件
copyPlugin 复制某个目录到指定目录
analyzePlugin 代码分析
ignorePlugin 忽略插件
dll dll环境全量配置
dev dev环境全量配置
build 生产环境全量配置
analyze 代码分析环境全量配置
获取全局配置文件并修改webpack配置 merge.smart
// 修改config/webpack.config.js
expandConfig/* 配置名称 */: (original/* 默认配置 */) => {
  // 合并规则(merge.smart)
  return {
    // 自定义配置
  };
}

Readme

Keywords

Package Sidebar

Install

npm i @chaoswise/scaffold

Weekly Downloads

588

Version

1.1.6

License

MIT

Unpacked Size

239 kB

Total Files

83

Last publish

Collaborators

  • cloudwise
  • howard.gu