Closed northsea4 closed 1 year ago
Windows 10 Chrome v83 vite-plugin-monkey v2.10.0
设置了vite构建选项build.cssTarget,npm run build后发现,HelloWorld.vue里.read-the-docs的定位样式被编译为了inset:60px 0 0 260px;,而inset是chrome87才开始支持的,所以似乎是某种处理导致build.cssTarget没有生效。
build.cssTarget
npm run build
HelloWorld.vue
.read-the-docs
inset:60px 0 0 260px;
inset
import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; import monkey, { cdn } from 'vite-plugin-monkey'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), monkey({ entry: 'src/main.ts', userscript: { icon: 'https://vitejs.dev/logo.svg', namespace: 'npm/vite-plugin-monkey', match: ['https://www.google.com/'], }, build: { minifyCss: true, externalGlobals: { vue: cdn.jsdelivr('Vue', 'dist/vue.global.prod.js'), }, }, }), ], build: { cssTarget: 'chrome83', } });
<style scoped> .read-the-docs { color: #888; position: fixed; top: 60px; right: 0; bottom: 0; left: 260px; background: #fff; z-index: 1050; padding: 10px 20px 200px 20px; overflow-y: auto; box-shadow: -2px 2px 6px #bbbbbb; } </style>
麻烦大神看一下是怎么回事,感谢!
应该是此处
https://github.com/lisonge/vite-plugin-monkey/blob/07cd87ad3f8e773553222fec8c578672bf8b699c/packages/vite-plugin-monkey/src/node/_util.ts#L278-L282
没有传递 target 导致的
我后续修复一下
备注:类似的问题可在此处找到 esbuild#1925
fixed by v2.10.1
环境
Windows 10 Chrome v83 vite-plugin-monkey v2.10.0
简述
设置了vite构建选项
build.cssTarget
,npm run build
后发现,HelloWorld.vue
里.read-the-docs
的定位样式被编译为了inset:60px 0 0 260px;
,而inset
是chrome87才开始支持的,所以似乎是某种处理导致build.cssTarget
没有生效。vite.config.ts
src/components/HelloWorld.vue
麻烦大神看一下是怎么回事,感谢!