1234567891011121314151617181920212223242526272829 |
- import fs from "node:fs";
- import path from "node:path";
- import { ResolvedConfig } from "vite";
- let ViteConfitExtendOptions={
- indexPath: ''
- }
- export default function viteConfitExtend(options) {
- let _config= ResolvedConfig;
- const _options = options;
- return {
- name: "index-path-extend",
- configResolved(config) {
- _config = config;
- },
- closeBundle() {
- if (_config.command == "build" && _options) {
- if (_options.indexPath) {
- fs.renameSync(
- path.resolve(_config.root, _config.build.outDir, "index.html"),
- path.resolve(_config.root, _config.build.outDir, _options.indexPath)
- );
- console.warn(`indexPath: ${_options.indexPath}`);
- }
- }
- },
- };
- }
|