remove speedy plugin

This commit is contained in:
Innei 2026-02-27 21:32:13 +08:00
parent bda84d48cb
commit bf986afeb1
No known key found for this signature in database
GPG key ID: 0F62D33977F021F7
2 changed files with 0 additions and 27 deletions

View file

@ -1,25 +0,0 @@
import type { Plugin } from 'vite';
/**
* Forces emotion's speedy mode in antd-style.
*
* antd-style hardcodes `speedy: false` in both createStaticStyles and
* createInstance, which causes emotion to create a new <style> element
* for every CSS rule (n % 1 === 0 is always true).
* With speedy: true, one <style> tag holds up to 65 000 rules via
* CSSStyleSheet.insertRule(), eliminating thousands of DOM insertBefore calls.
*/
export function viteEmotionSpeedy(): Plugin {
return {
name: 'emotion-speedy',
enforce: 'pre',
transform(code, id) {
if (id.includes('antd-style') && code.includes('speedy: false')) {
return {
code: code.replaceAll('speedy: false', 'speedy: true'),
map: null,
};
}
},
};
}

View file

@ -3,7 +3,6 @@ import { codeInspectorPlugin } from 'code-inspector-plugin';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import tsconfigPaths from 'vite-tsconfig-paths';
import { viteEmotionSpeedy } from './emotionSpeedy';
import { viteNodeModuleStub } from './nodeModuleStub';
import { vitePlatformResolve } from './platformResolve';
@ -116,7 +115,6 @@ interface SharedRendererOptions {
export function sharedRendererPlugins(options: SharedRendererOptions) {
const defaultTsconfigPaths = options.tsconfigPaths ?? true;
return [
viteEmotionSpeedy(),
nodePolyfills({ include: ['buffer'] }),
viteNodeModuleStub(),
vitePlatformResolve(options.platform),