Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

语义化配置 beta #280

Open
soda-x opened this issue May 24, 2017 · 0 comments
Open

语义化配置 beta #280

soda-x opened this issue May 24, 2017 · 0 comments
Assignees
Milestone

Comments

@soda-x
Copy link

soda-x commented May 24, 2017

配置项 含义 方式 特别说明 webpack
entry 入口文件 {key,value} / [pattern]
示例:{ "entry": { "index" : "/path/to/index"} } / ['./src/entry/*.js']
键值对方式书写,通过 pattern 把某一类或某一个目录下或兼并的脚本作为 entry entry
output 编译后导出文件相关设置 {filename, path, publicPath, chunkFileName}
示例:{filename:'[name].[ext]',path:'./dist',publicPath:'http://xx.xxx.com/asset/', chunkFileName: '[name].[ext]'}
filename: 改构建后文件的命名
path: 构建后文件输出到磁盘的目录
publicPath: 申明构建后的资源文件的引入地址
chunkFilename: 声明非 entry chunks 的资源文件的命名
output
hash 深度缓存方案 { enable: true }
示例:{ enable: true }
output, etc..
library bundle 将被处理为 library 默认为 false 一旦设置为非 false 后,可以传入 var, this, commonjs, commonjs2, amd, umd
示例 {library: 'commonjs'}
设置 library 所遵从的规范 output.library
alias 设置模块别名 {key, value}
示例:{moduleA: 'path/to/modulea'}
达到差异化构建的目的 resolve.alias
noParse 设置忽略 parse 模块 [RegExp]
示例:[/moment.js/]
使用正则表达式 resolve.noParse
resolveModule 模块检索设置 {modules,extensions}
示例:{modules: ['./src'], extensions:['.worker.js','.js', '.json']}
modules: 在检索模块时告知 webpack 那些目录需要检索
extensions:在检索模块时告知 webpack 那些扩展名需要检索
resolve.modules
resolveLoader loader检所设置 {modules,extensions}
示例:{modules: ['node-modules'], extensions:['-loader']}
modules: 在检索loader 时告知 webpack 那些目录需要检索
extensions:在检索 loader 时告知 webpack 那些扩展名需要检索
resolve.resolveLoader
externals 模块声明为外部依赖 {key,value}
示例:{jquery: 'jQuery'}
需要配套 cdn 方案 webpack.externals
common commonChunk抽取 {minChunks}
示例:common: { minChunks: 2}
minChunks: 最小抽取单元 CommonsChunkPlugin
vendor 特定 common 抽取 [entryName/library]
示例:['moment.js','jquery']
手动抽取 common webpack.entry
devtool devtool 设置 条目
示例:{devtool: '#source-map'}
建议使用 cheap-module-source-map sourceMap
node Include polyfills or mocks for various node stuff 可以基本忽略 node
theme less 变量覆盖 {}/filePath
示例:{'@buttonTxtColor': '#333333'}
实现一些 library less 变量的覆盖,比如 antd atool-build
css css-loader 设置 { import, modules, minimize, sourceMap }
示例:{ import: true, modules: true}
css-loader
less less-loader 设置 { sourceMap }
示例:{ sourceMap: true}
rem 是否启用 rem 方案 { postcss-plugin-px2rem.config }
示例:{rem: {rootValue: 100}
加载 postcss-pxtorem postcss-plugin-px2rem
image 转为 base64 临界值设定 {limit: 64, }
示例:{image:{limit: 1000}
设定临界值
font 转为 base64 临界值设定 {limit}
示例:{font:{limit: 1000}
设定临界值
svg svg 特殊处理 {include,exclude, type: ''}
示例:{type:'url-loader'}
extractStyle sytle 抽取设定 extract-text-webpack-plugin
define webpack definePlugin 设定 {key,value}
示例:{PRODUCTION: JSON.stringify(true)}
DefinePlugin
provide webpack providePlugin 设定 {key,value}
示例:{$: 'jquery'}
ProvidePlugin
uglify uglify 参数设定 boolean
示例:``{uglify: true}````
webpack.optimize.UglifyJsPlugin
dll webpack dllPlugin 设定 []
treeShaking 是否开启 treeShaking 功能 []
browser 浏览器兼容设置 ['last 2 versions']
示例:['iOS >= 8', 'Android >= 4']
es3ify-loader
html 自动化 html 生成 {key,value}
示例:{html: { x: 'y',template: 'path/to/x.html' }}
extraLoaders 额外载入 loader [{key,value}]
示例:[{package: 'vue-loader',options:{},deps{}}]
extraPlugins 额外载入 plugin [{key,value}]
示例:[{package: 'visualPlugin',options:{},deps{}}]
copy copy webpack plugin [pattern]
示例:{copy: ['./xx/*.*']}
clean clean webpack plugin [pattern]
示例:{clean: ['./www']}
shell 提供 shell 执行时机 {key,value}
示例:{shell:{onBuildStart:'xxx', onBuildEnd:'xxxx'}}
boost 加速构建 - 包含平行构建和 happypack 布尔
示例:{boost: true}
parallel-compress
lessAlias less import map {key,value}
示例:{lessMap: { theme: './config/a.less'}}
less loader + less-plugin-rewrite-import
@soda-x soda-x added this to the 1.0.0 milestone May 24, 2017
@soda-x soda-x self-assigned this May 24, 2017
@soda-x soda-x changed the title 内建配置 beta 语义化配置 beta May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
atool-build@1.0.0
Awaiting triage
Development

No branches or pull requests

1 participant