@youdeyiwu/vite-plugin-mp
TypeScript icon, indicating that this package has built-in type declarations

0.5.2 • Public • Published

vite-plugin-youdeyiwu-mp

使用 vite + typescript + sass 构建编译微信小程序

注意使用的版本,该插件测试的模板为微信小程序 Ts + Scss,以及 Vite 5

安装

  • yarn
yarn add -D glob rollup-plugin-copy

使用

  • 编辑 vite.config.ts 文件添加插件
import {defineConfig} from 'vite';
import path from "path";
import youdeyiwuMp from '@youdeyiwu/vite-plugin-mp';

export default defineConfig({
    plugins: [
        youdeyiwuMp({
            buildDir: path.resolve(__dirname, 'miniprogram'),
            outputDir: path.resolve(__dirname, 'dist')
        })
    ]
})
  • 构建编译小程序
yarn build

选项

  • buildDir 必填。编译小程序的代码目录
  • outputDir 必填。输出编译小程序的代码目录

其他

如果遇到无法编译,考虑移除该插件,因为该插件只是使用 vite 来对文件进行编译而已

即使不使用 vite,微信开发者工具也能进行编译,除此之外没有区别

移除该插件,剩下的就是熟悉的微信小程序代码

License

MIT

Package Sidebar

Install

npm i @youdeyiwu/vite-plugin-mp

Weekly Downloads

3

Version

0.5.2

License

MIT

Unpacked Size

10.1 kB

Total Files

6

Last publish

Collaborators

  • dafengzhen