Title: Error when bundling with esbuild using custom unplugin · Issue #517 · unjs/unplugin · GitHub
Open Graph Title: Error when bundling with esbuild using custom unplugin · Issue #517 · unjs/unplugin
X Title: Error when bundling with esbuild using custom unplugin · Issue #517 · unjs/unplugin
Description: Environment node: 20 unplugin: 2.3.5 Reproduction https://github.com/BoYuanSu/unplugin-unused-components/tree/fix/esbuild-test install deps, pnpm i. change directory to esbuild-plugin-test cd ./tests/esbuild-plugin-test/. run test script...
Open Graph Description: Environment node: 20 unplugin: 2.3.5 Reproduction https://github.com/BoYuanSu/unplugin-unused-components/tree/fix/esbuild-test install deps, pnpm i. change directory to esbuild-plugin-test cd ./tes...
X Description: Environment node: 20 unplugin: 2.3.5 Reproduction https://github.com/BoYuanSu/unplugin-unused-components/tree/fix/esbuild-test install deps, pnpm i. change directory to esbuild-plugin-test cd ./tes...
Opengraph URL: https://github.com/unjs/unplugin/issues/517
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error when bundling with esbuild using custom unplugin","articleBody":"### Environment\n\nnode: 20\nunplugin: 2.3.5\n\n### Reproduction\n\nhttps://github.com/BoYuanSu/unplugin-unused-components/tree/fix/esbuild-test\n\n1. install deps, `pnpm i`.\n\n2. change directory to esbuild-plugin-test `cd ./tests/esbuild-plugin-test/`.\n\n3. run test script `pnpm run test`.\n\n### Describe the bug\n\nI'm developing a custom plugin based on `unplugin`, designed to scan my project for components and report unused ones. It works as expected in `vite` and `webpack`, but when I try to test it with `esbuild`, I encounter the following error:\n\n```sh\nstdout | esbuild.test.ts > esbuild > should run esbuild tests\nFound 2 unused components:\n- /Users/user/Desktop/boyuansu/unplugin-unused-components/tests/fixtures/TestUnused.vue\n- /Users/user/Desktop/boyuansu/unplugin-unused-components/tests/fixtures/TestUnusedReact.jsx\n\n ❯ esbuild.test.ts (1 test | 1 failed) 60ms\n × esbuild > should run esbuild tests 59ms\n → Build failed with 2 errors:\n../fixtures/TestUsed.vue:1:0: ERROR: The JSX syntax extension is not currently enabled\n../fixtures/TestUsed.vue:4:10: ERROR: Expected \"}\" but found \"{\"\n```\nI've tried to remove my custom plugin and the fixtures setup work fine with esbuild config. \nIs there anything specific I need to do to support esbuild with unplugin?\nAny known caveats or extra config I might be missing?\n\nThanks! \n\n### Additional context\n\n_No response_\n\n### Logs\n\n```sh\n\n```","author":{"url":"https://github.com/BoYuanSu","@type":"Person","name":"BoYuanSu"},"datePublished":"2025-06-25T08:11:23Z","url":"https://github.com/unjs/unplugin/issues/517"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:62b4fd90-353b-3bba-17a2-5272bf4193b3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D23E:26B9F0:4DE62D:6CCF99:6B00736C |
| html-safe-nonce | c10eec4fcc187c1d830389454b72ea47d62e5cac72b072b85a8399a40f11af7f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjNFOjI2QjlGMDo0REU2MkQ6NkNDRjk5OjZCMDA3MzZDIiwidmlzaXRvcl9pZCI6IjQwOTgzODk2MjQzNDE0MzA4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3258f438e0ccdb037177c20ccdfcf03fd084424c0a76f438138e59b0918d1e19 |
| hovercard-subject-tag | issue:3174655543 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/unjs/unplugin/517/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bdfa9072742c09c053e7b702bc5e0ae92b6ac6b57a034c1e2f4c45773004f39e/unjs/unplugin/issues/517 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bdfa9072742c09c053e7b702bc5e0ae92b6ac6b57a034c1e2f4c45773004f39e/unjs/unplugin/issues/517 |
| og:image:alt | Environment node: 20 unplugin: 2.3.5 Reproduction https://github.com/BoYuanSu/unplugin-unused-components/tree/fix/esbuild-test install deps, pnpm i. change directory to esbuild-plugin-test cd ./tes... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | BoYuanSu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 75c2b65dd205f26961d0c29afed1a8d0bb7cca9f05780571dfd1ef93eb539d16 |
| turbo-cache-control | no-preview |
| go-import | github.com/unjs/unplugin git https://github.com/unjs/unplugin.git |
| octolytics-dimension-user_id | 80154025 |
| octolytics-dimension-user_login | unjs |
| octolytics-dimension-repository_id | 385261169 |
| octolytics-dimension-repository_nwo | unjs/unplugin |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 385261169 |
| octolytics-dimension-repository_network_root_nwo | unjs/unplugin |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84e563eb4b55f8fa102f325f117533cee9e3df4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width