Vite自定义build配置的问题
Vue3+Vite,vite.config.js内容为:import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default defineConfig({
base: './',
plugins: ,
build: {
rollupOptions: {
input: {
popup: resolve(__dirname, 'src/popup/popup.html')
},
output: {
dir: 'dist',
assetFileNames: '/.',
chunkFileNames: 'js/.js',
entryFileNames: e => `${e.name}/.js`
}
}
}
})
以上代码,build后,输出3个文件,分别是
vite v4.5.0 building for production...
✓ 1383 modules transformed.
dist/src/popup/popup.html
dist/popup/popup.css
dist/popup/popup.js
问题:如果我希望popup.html文件的输出路径改为dist/popup/popup.html,应该怎么写?
https://cn.vitejs.dev/config/build-options.html#build-outdir
看文档不难 assetFileNames: (chunkInfo) => {
if (chunkInfo.name === 'popup') {
return 'popup/popup.'
}
return '/.'
}
试试
页:
[1]