{"id":40948,"library":"esbuild-plugin-vite-element-ui","title":"esbuild-plugin-vite-element-ui","description":"An esbuild plugin that resolves the common issue where Element UI components cannot be used properly in Vite projects due to the `$isServer` property being undefined. Current stable version is 1.0.2, with infrequent releases. It addresses a specific compatibility problem between Element UI and Vite's dependency optimization by patching the Element UI module during esbuild bundling. This plugin is a targeted solution for developers who use Element UI with Vite and encounter runtime errors related to `$isServer`.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/dravenww/esbuild-plugin-vite-element-ui","tags":["javascript","esbuild","plugin","vite","element-ui"],"install":[{"cmd":"npm install esbuild-plugin-vite-element-ui","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-vite-element-ui","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-vite-element-ui","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; CommonJS require will fail.","wrong":"const esbuildPlugin = require('esbuild-plugin-vite-element-ui')","symbol":"default","correct":"import esbuildPlugin from 'esbuild-plugin-vite-element-ui'"}],"quickstart":{"code":"// vite.config.js\nimport { defineConfig } from 'vite';\nimport esbuildPlugin from 'esbuild-plugin-vite-element-ui';\n\nexport default defineConfig({\n  optimizeDeps: {\n    esbuildOptions: {\n      plugins: [\n        esbuildPlugin()\n      ]\n    }\n  }\n});\n\n// Ensure Element UI is installed: npm install element-ui\n// Then import Element UI normally in your main.js\nimport Vue from 'vue';\nimport ElementUI from 'element-ui';\nimport 'element-ui/lib/theme-chalk/index.css';\n\nVue.use(ElementUI);","lang":"javascript","description":"Shows how to configure the esbuild plugin in vite.config.js to fix Element UI '$isServer' error."},"warnings":[{"fix":"Place the plugin inside optimizeDeps.esbuildOptions.plugins, as shown in the quickstart.","message":"The plugin must be used only in the esbuild optimization step, not as a general Vite plugin.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure you import Element UI normally (not individual components) for the plugin to patch correctly.","message":"The plugin may not work with custom Element UI builds or tree-shaken imports.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.2':37 'address':42 'bundl':63 'cannot':19 'common':13 'compat':45 'compon':18 'current':33 'depend':53 'develop':71 'due':26 'element':5,16,48,58,74,90 'element-ui':89 'encount':79 'error':81 'esbuild':2,8,62,86 'esbuild-plugin-vite-element-ui':1 'infrequ':39 'isserv':29,84 'issu':14 'javascript':85 'modul':60 'optim':54 'patch':56 'plugin':3,9,65,87 'problem':46 'project':25 'proper':22 'properti':30 'relat':82 'releas':40 'resolv':11 'runtim':80 'solut':69 'specif':44 'stabl':34 'target':68 'ui':6,17,49,59,75,91 'undefin':32 'use':21,73 'version':35 'vite':4,24,51,77,88","created_at":"2026-06-04T18:50:02.967679+00:00","updated_at":"2026-06-04T18:50:02.967679+00:00","problems":[{"fix":"Install and configure esbuild-plugin-vite-element-ui as shown in the quickstart.","cause":"Element UI expects a CommonJS environment but Vite's esbuild tree-shaking removes the global Vue reference.","error":"Cannot read property '$isServer' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/dravenww/esbuild-plugin-vite-element-ui#readme","github":"https://github.com/dravenww/esbuild-plugin-vite-element-ui","docs":null,"changelog":null,"pypi":null,"npm":"esbuild-plugin-vite-element-ui","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}