首页 » 前端 » Vue.js » 正文

Vite 配置项收集 1+

发布者:站点默认
2023/04/18 浏览数(232) 分类:Vue.js Vite 配置项收集 1+已关闭评论

官方文档在这里:https://vitejs.dev/config/

让 Vue 认出 html 原生的 marquee 标签

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

export default () => {
  return defineConfig({
    plugins: [
      vue({
        template: {
          compilerOptions: {
            isCustomElement: (tag) => ['marquee'].includes(tag), // vue3 居然不认识 marquee
          },
        },
      }),
    ],
  });
};

yarn build 后再做些什么

import { defineConfig } from 'vite';

export default ({ mode }) => {
  return defineConfig({
    plugins: [
      {
        name: 'build-end',
        buildEnd(error) {
          if (mode == 'production') {
            console.log('编译完成。', error || '');
          }
        },
        closeBundle() {
          if (mode == 'production') {
            console.log('打包完成');
          }
        },
      },
    ],
  });
};
点击返回顶部
  1. 留言
  2. 联系方式