2021-03-17 00:10:16 +08:00
|
|
|
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',
|
2021-11-30 00:53:26 +08:00
|
|
|
// handleHotUpdate({ modules, file }) {
|
|
|
|
// if (file.match(/xml$/)) return [];
|
2021-04-19 23:40:59 +08:00
|
|
|
|
2021-11-30 00:53:26 +08:00
|
|
|
// modules.forEach((m) => {
|
|
|
|
// if (!m.url.match(/\.(css|less)/)) {
|
|
|
|
// m.importedModules = new Set();
|
|
|
|
// m.importers = new Set();
|
|
|
|
// }
|
|
|
|
// });
|
2021-04-19 23:40:59 +08:00
|
|
|
|
2021-11-30 00:53:26 +08:00
|
|
|
// return modules;
|
|
|
|
// },
|
2021-03-17 00:10:16 +08:00
|
|
|
};
|
|
|
|
}
|