vite-plugin-pwa
什么是pwa
unplugin-vue-components
使用按需加载element-plus组件库样式的写法导致页面卡顿厉害
完善vxe-table自动导入
https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/element-ui.ts
https://cn.vitejs.dev/guide/api-plugin.html#plugin-ordering
https://juejin.cn/post/7075678169122439181
js
Components({
resolvers: [
(componentName) => {
console.log('componentName', componentName);
if (componentName.startsWith('Vxe'))
return { name: componentName.slice(3), from: 'vxe-table' };
},
],
}),
Components({
resolvers: [
(componentName) => {
console.log('componentName', componentName);
if (componentName.startsWith('Vxe'))
return { name: componentName.slice(3), from: 'vxe-table' };
},
],
}),
控制vite在浏览器显示的报错信息
js
export function eslintPlugin() {
return {
name: 'eslint',
transform(code, id) {
if (/src\/main.js$/.test(id)) {
this.error('识别src/main.js出错');
}
},
};
}
export function eslintPlugin() {
return {
name: 'eslint',
transform(code, id) {
if (/src\/main.js$/.test(id)) {
this.error('识别src/main.js出错');
}
},
};
}