# 从 1.x 升级到 2.0

balm.config 全面升级 🎉

加粗: 新增的,默认: 改变的

# 1. 环境

  • config.static => config.inFrontend
  • config.env
    • config.isProd => config.env.isProd
    • config.isTest => config.env.isTest
    • config.isDev => config.env.isDev
    • config.inSSR => config.env.inSSR
  • config.useDefault => config.useDefaults
balm.go((mix) => {
  console.log(balm.config.env); // 输出:{ isProd, isTest, isDev, inSSR }
  console.log(mix.env); // 等同于 `balm.config.env`
});

# 2. 样式和雪碧图

# 2.1 样式

  • config.styles.ext => config.styles.extname
  • config.styles.minified
  • config.styles.includePaths => config.styles.atImportPaths
  • config.styles.postcssOptions

# 2.2 雪碧图

  • config.sprites.basePath => config.styles.imageBasePath
  • config.sprites.image => config.styles.sprites
  • config.sprites.padding
  • config.styles.spriteRetina
  • config.styles.spriteParams

# 3. 脚本

  • config.scripts.include => config.scripts.includeJsResource
  • config.scripts.disableDefaultLoaders
  • config.scripts.webpack => config.scripts.webpackOptions
  • config.scripts.vendors
  • config.scripts.cssLoader
  • config.scripts.eslint => config.scripts.lint

# 4. 服务

  • config.server.browser
  • config.server.logLevel
  • config.server.reloadDelay
  • config.server.proxyContext
  • config.server.proxyOptions
  • config.server.extraWatchFiles

# 5. 静态资源打包

  • config.assets.virtualDir
  • config.cache => config.assets.cache

# 6. 日志

  • config.debug
  • config.logs
    • .level
    • .formatOptions
balm.config = {
  logs: {
    level: 3, // [0, 4] the smaller, the detailed
    formatOptions: {}
  }
};
Last Updated: 4 years ago