Closed gaoliang-l closed 1 year ago
Hello @gcq-z. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction
will be closed if they have no activity within 3 days.
import { defineConfig } from 'vite' import path from 'path' import vue from '@vitejs/plugin-vue' import AutoImport from 'unplugin-auto-import/vite' import VueComponents from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import { VantResolver } from 'unplugin-vue-components/resolvers' import UNO_CSS from 'unocss/vite' import legacy from '@vitejs/plugin-legacy'
// https://vitejs.dev/config/ export default defineConfig({ resolve: { // 设置src别名 alias: { '@': path.resolve(__dirname, 'src') } }, plugins: [ vue(), AutoImport({ imports: ['vue', 'vue-router'], resolvers: [ElementPlusResolver()], dts: 'src/auto-import.d.ts' }), VueComponents({ dts: 'src/components.d.ts', resolvers: [ElementPlusResolver(), VantResolver()] }), UNO_CSS(), legacy({ targets: ['chrome 58'] }) ], publicDir: 'public', base: './', build: { // target:['chrome 58'], rollupOptions: { output: { chunkFileNames: 'js/[name]-[hash].js', entryFileNames: 'js/[name]-[hash].js', assetFileNames: '[ext]/[name]-[hash].[ext]' } } } })
Related plugins
[X] plugin-vue
[ ] plugin-vue-jsx
Describe the bug
I use legacy on vite4.2.0+@ vitejs/plugin legacy4{
targets: ['chrome 58']
}Error reported during rendering chunks
Reproduction
not have
Steps to reproduce
Run 'npm run build' :[vite:css-post] Plugin error - Unable to get file name for unknown file "2fa9c3fa". ✓ built in 7.80s error during build: RollupError: Plugin error - Unable to get file name for unknown file "2fa9c3fa". at error (file:///vite-project-platform/node_modules/rollup/dist/es/shared/node-entry.js:2128:30) at Object.FileEmitter.getFileName (file:///vite-project-platform/node_modules/rollup/dist/es/shared/node-entry.js:23972:24) at file:///vite-project-platform/node_modules/vite/dist/node/chunks/dep-79892de8.js:38026:43 at String.replace ()
at resolveAssetUrlsInCss (file:///vite-project-platform/node_modules/vite/dist/node/chunks/dep-79892de8.js:38025:37)
at Object.renderChunk (fvite-project-platform/node_modules/vite/dist/node/chunks/dep-79892de8.js:38054:32)
at file:///vite-project-platform/node_modules/rollup/dist/es/shared/node-entry.js:24395:40
at processTicksAndRejections (node:internal/process/task_queues:96:5)
System Info
Used Package Manager
npm
Logs
No response
Validations