同步vben代码,删除作废插件
parent
3c3353da4f
commit
32ffd19dc4
|
@ -1,21 +0,0 @@
|
|||
// TODO
|
||||
import type { GetManualChunk } from 'rollup';
|
||||
|
||||
//
|
||||
const vendorLibs: { match: string[]; output: string }[] = [
|
||||
// {
|
||||
// match: ['xlsx'],
|
||||
// output: 'xlsx',
|
||||
// },
|
||||
];
|
||||
|
||||
// @ts-ignore
|
||||
export const configManualChunk: GetManualChunk = (id: string) => {
|
||||
if (/[\\/]node_modules[\\/]/.test(id)) {
|
||||
const matchItem = vendorLibs.find((item) => {
|
||||
const reg = new RegExp(`[\\/]node_modules[\\/]_?(${item.match.join('|')})(.*)`, 'ig');
|
||||
return reg.test(id);
|
||||
});
|
||||
return matchItem ? matchItem.output : null;
|
||||
}
|
||||
};
|
|
@ -1,25 +0,0 @@
|
|||
import type { Plugin } from 'vite';
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* Temporarily solve the Vite circular dependency problem, and wait for a better solution to fix it later. I don't know what problems this writing will bring.
|
||||
* @returns
|
||||
*/
|
||||
|
||||
export function configHmrPlugin(): Plugin {
|
||||
return {
|
||||
name: 'singleHMR',
|
||||
handleHotUpdate({ modules, file }) {
|
||||
if (file.match(/xml$/)) return [];
|
||||
|
||||
modules.forEach((m) => {
|
||||
if (!m.url.match(/\.(css|less)/)) {
|
||||
m.importedModules = new Set();
|
||||
m.importers = new Set();
|
||||
}
|
||||
});
|
||||
|
||||
return modules;
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue