mirror of
https://github.com/lobehub/lobehub
synced 2026-04-21 09:37:28 +00:00
remove speedy plugin
This commit is contained in:
parent
bda84d48cb
commit
bf986afeb1
2 changed files with 0 additions and 27 deletions
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in a new issue