Skip to content

.fatherrc.ts配置文件

text
import { defineConfig } from 'father'
import path from 'path'

// 配置项文档:https://github.com/umijs/father/blob/master/docs/config.md
export default defineConfig({
  input: 'src',   // 默认打包目录:
  output: 'dist', // 默认打包输出目录
  esm: {}, // 需要打ESModule包
  cjs: {}, // 需要打Commonjs包
  umd: {}, // 需要打umd全局引入包
  alias: { // 自定义引入别名
    '@': path.resolve(__dirname, './src'),
  },
  platform: 'browser', // 包使用平台浏览器
  plugins: ['./scripts/publish-father-plugin'], // 打包插件
})

安装father

text
npm install father -D

package.json 添加打包命令

text
{
  ...
  "scripts": {
    "build": "father build",
  },
  ...
}

Contributors

作者:Long Mo
字数统计:140 字
阅读时长:1 分钟
Long Mo
文章作者:Long Mo
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Longmo Docs