We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我想在 viteCompression 之后增加一个自定义的 Vite 插件,但是我增加的插件无法保证在 viteCompression 后面执行,总是先于它执行,为什么呢?
viteCompression
vite.config.ts:
vite.config.ts
import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { viteSingleFile } from 'vite-plugin-singlefile' import viteCompression from 'vite-plugin-compression' import vitePROGMEM from './vite-plugin-progmem' // <-- 自定义插件 export default defineConfig({ plugins: [ vue(), viteSingleFile(), viteCompression(), vitePROGMEM({ source: './dist/index.html.gz', destination: './dist/index.h' }) ], //... })
vite-plugin-progmem:
vite-plugin-progmem
import { Plugin } from "vite" import * as fs from 'fs' interface vitePluginPROGMEMOptions { /** * Source of the .html.gz file */ source: string; /** * Destination of the .h file */ destination: string; } export default function vitePROGMEM(options: vitePluginPROGMEMOptions): Plugin { return { name: "vite:progmem", apply: 'build', async closeBundle() { console.log(options) console.log('source: ' + fs.existsSync(options.source)); console.log('destination: ' + fs.existsSync(options.destination)); // .gz 文件不存在 } } }
The text was updated successfully, but these errors were encountered:
同样的问题,难道不能以插件的形式,只能用success方法来回调了?
Sorry, something went wrong.
这个问题我也遇到了,原因是源码里面的closeBundle函数根本就不能是一个async函数 里面的await全都没用、我改成node的同步函数就可以了
No branches or pull requests
我想在
viteCompression
之后增加一个自定义的 Vite 插件,但是我增加的插件无法保证在viteCompression
后面执行,总是先于它执行,为什么呢?vite.config.ts
:vite-plugin-progmem
:The text was updated successfully, but these errors were encountered: