@forchange/cli-service

0.2.2 • Public • Published

cli-service

模式

开发模式

cli-service dev

构建模式

cli-service build --mode production

项目配置

通过项目根目录的pack.config.js文件对项目进行配置。

mode可以指定构建环境,对应的环境可以指定一些参数,环境无定义的参数,则取common中的值。

var path = require('path')
module.exports = {
  // 构建时会覆盖被合并到配置中
  webpackConfig: {
    context: __dirname,
    entry: {
      app: path.resolve(__dirname, 'src/app/index.ts')
    },
    resolveLoader: {
      modules: [path.resolve(__dirname, 'src'), path.resolve(__dirname, 'node_modules')]
    },
    resolve: {
      modules: [path.resolve(__dirname, 'src'), path.resolve(__dirname, 'node_modules')],
      alias: {
        app: path.resolve('src/app')
      }
    }
  },
  common: {
    title: 'vue template',
    indexTemplate: path.resolve(__dirname, 'src/index.html'),
    indexOutput: path.resolve(__dirname, 'dist/index.html'),
    staticOriginDirctory: path.resolve(__dirname, 'src/app/static'),
    assetsRoot: path.resolve(__dirname, 'dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: '//acdnpy.pandateacher.com/',
    bundleAnalyzerReport: false
  },
  production: {
    sourceMap: true,
    bundleAnalyzerReport: false
  },
  debug: {
    sourceMap: true,
    bundleAnalyzerReport: false
  },
  development: {
    port: 8085,
    indexOutput: 'index.html',
    autoOpenBrowser: false,
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {},
    sourceMap: true
  }
}

TODO

  1. 整理依赖
  2. 配置文件路径可修改
  3. 完善各命令功能
  4. 完善配置说明

Readme

Keywords

none

Package Sidebar

Install

npm i @forchange/cli-service

Weekly Downloads

0

Version

0.2.2

License

ISC

Unpacked Size

23.4 kB

Total Files

15

Last publish

Collaborators