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

参数整理 #6

Closed
sorrycc opened this issue Apr 9, 2015 · 5 comments
Closed

参数整理 #6

sorrycc opened this issue Apr 9, 2015 · 5 comments

Comments

@sorrycc
Copy link
Member

sorrycc commented Apr 9, 2015

整理了配置项,构建相关的参数放到 build 下了。(spmjs/spm-argv#1)

@popomore @afc163 看下有没有问题。比如命名或者其他的问题。

{
  "name": "",
  "version": "",

  "spm": {

    "build": {
      // -- 依赖解析
      // 指定不解析的模块或文件
      "global": {
        "react": "React",
        "./a": "AAA"
      },
      // 开启或禁用 node 模块的 polyfills
      "node": {
        "global": false
      },

      // -- 性能
      // 提取依赖为 vendor.js
      "vendor": ["jquery", "underscore"],
      // 提取公共 chunk 为 common.js
      "common": true,
      "base64": {},

      // -- 语言类
      "babel": {},
      "uglify": {},
      "autoprefixer": {},
      "less": {},
      "coffee": {},
      "jsx": {},
      "handlebars": {},

      // -- 输出
      "dest": "./build",
      "hash": true,
      // 提取入口 js 文件依赖链中的 CSS chunk,输出和入口文件同名的 css 文件
      "extractCSS": true,
      // 输出的包名
      "library": "",
      // this, umd, common, amd, var 等等
      "libraryTarget": "",
      // 等同于 libraryTarget: umd, library: Foo
      "umd": "Foo",

      // -- 扩展
      "loader": {
        ".js": "+jsdc-babel"
      }
    },

    "registry": ""
  }
}
@sorrycc
Copy link
Member Author

sorrycc commented Apr 9, 2015

命令行参数:

  • --force, 从源上重新拉依赖包
  • --clean, 清空 output directory
  • --watch, watch mode
  • --registry
  • --debug, 不压缩
  • --verbose, 更多日志

@afc163
Copy link
Member

afc163 commented Apr 9, 2015

很复杂和强大,可以说明下哪些配置和 webpack 是一致的。

@sorrycc
Copy link
Member Author

sorrycc commented Apr 9, 2015

明天我搞个对照表。

@sorrycc
Copy link
Member Author

sorrycc commented Apr 10, 2015

对照表:

spm webpack note
global externals
node node
vendor CommonsChunkPlugin
common CommonsChunkPlugin
base64 url-loader
babel babel-loader
uglify UglifyJsPlugin
autoprefixer autoprefixer-loader
less less-loader
coffee coffee-loader
jsx jsx2-loader
handlebars handlebars-loader
library library
libraryTarget libraryTarget
umd
extractCSS ExtractTextPlugin
hash [hash] in filename
loader

参考:
http://webpack.github.io/docs/configuration.html
http://webpack.github.io/docs/list-of-plugins.html
http://webpack.github.io/docs/list-of-loaders.html

@sorrycc
Copy link
Member Author

sorrycc commented Apr 15, 2015

@sorrycc sorrycc closed this as completed Apr 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants