那试一下插件
[JavaScript] 纯文本查看 复制代码 import { Plugin } from 'vite'
export function changeHtmlOutputPath(): Plugin {
return {
name: 'change-html-output-path',
transformIndexHtml(html) {
return html.replace('dist/', 'dist/popup/')
}
}
}
[Asm] 纯文本查看 复制代码 import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { CRX_OUTDIR } from './viteBuildGlobalConfig'
import { changeHtmlOutputPath } from './changeHtmlOutputPath'
export default defineConfig({
base: './',
plugins: [vue(), changeHtmlOutputPath()],
build: {
rollupOptions: {
input: {
popup: resolve(__dirname, `src/popup/popup.html`)
},
output: {
dir: 'dist',
assetFileNames: '[name]/[name].[ext]',
chunkFileNames: 'js/[name].js',
entryFileNames: e => `${e.name}/[name].js`
}
}
}
}) |