-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用unocss打包后报错 #45
Comments
应该是 "*,:before,:after{--un-rotate:0;................................................" |
解压前去掉".gz" |
把 import path from 'node:path'
import { defineConfig } from 'vite'
import useVue from '@vitejs/plugin-vue'
import useMonkey, { cdn, util } from 'vite-plugin-monkey'
import useEslint from 'vite-plugin-eslint'
import useUnocss from 'unocss/vite'
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src/'),
},
},
plugins: [
useVue(),
useUnocss(),
useMonkey({
entry: 'src/main.js',
userscript: {
name: 'min-project',
author: 'viarotel',
namespace: 'viarotel/min-project',
description: 'min-project',
version: '0.0.1',
icon: 'https://vitejs.dev/logo.svg',
require: [],
},
build: {
externalGlobals: {
vue: cdn.jsdelivr('Vue', 'dist/vue.global.prod.js').concat(
await util.fn2dataUrl(() => {
// @ts-ignore
// eslint-disable-next-line no-undef
window.Vue = Vue
}),
),
},
},
}),
useEslint({ fix: true }),
],
}) |
好的 按照这个方法确实有效 感谢大佬的指导 |
一些补充 出现错误是因为 执行了替换操作,替换使用的正则是 https://github.com/unocss/unocss/blob/b1377a98e5b443dbec2c4bda166c9c0afbc04dfb/packages/shared-integration/src/layers.ts#L29 就把 js 代码里的 替换之前是 ("#--unocss--{layer:__ALL__}#--unocss-layer-start--__ALL__--{start:__ALL__} *,::before 替换之后是 ( *,::before |
v2.12.1 在 css 首尾加了两个空格,现在如果还让 unocss 在本插件后面工作时替换的字符串将不会缺失引号 也在文档里加了 和其他插件一起使用时, 顺序尽量放在最后一个的说明 |
The text was updated successfully, but these errors were encountered: