@kinngyo/weapack
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

weapp-package

用于小程序组件打包

安装

npm install @kinngyo/weapack
# 或者
yarn add @kinngyo/weapack

使用

命令

# 开发监听模式
weapack --watch

# 构建打包
weapack

Options

option 说明 类型 默认值
--file 入口文件,多个逗号分割 string --
--external 外部模块,多个逗号分割 string --
--outdir 输出目录 string ./dist
--tsconfig 自定义tsconfig.json string tsconfig.json
-w, --watch 是否开启监听模式 boolean false
  • 默认入口文件packages/**/\*.{js,ts,wxss,sass,scss,less,wxml,json,wxs}

配置文件

// weapack.config.ts

import { createEntrys, sassPlugin, lessPlugin } from '@kinngyo/weapack'

export default {
    // 入口文件
    entrys: createEntrys(
        'packages/**/*.{js,ts,wxss,sass,scss,less,wxml,json,wxs}',
        file => !/(?<=\.d).(js|ts)$/.test(file),
    ),
    // 输出目录
    outdir: 'dist',
    // 插件
    plugins: [sassPlugin(), lessPlugin()],
    // 解析文件
    loader: {
        '.js': 'js',
        '.ts': 'ts',
        '.wxss': 'copy',
        '.wxml': 'copy',
        '.json': 'copy',
        '.wxs': 'copy',
    },
    // 外部模块
    external: ['../common/*'],
    // 输出扩展名
    outExtension: {
        '.css': '.wxss',
    },
    // esbuild
    build: {
        bundle: true,
        format: 'esm',
        platform: 'node',
        logLevel: 'info',
    },
}

Readme

Keywords

none

Package Sidebar

Install

npm i @kinngyo/weapack

Weekly Downloads

2

Version

0.0.2

License

none

Unpacked Size

16.1 kB

Total Files

6

Last publish

Collaborators

  • kinngyo