{"id":17968490,"url":"https://github.com/hyrious/esbuild-plugin-svelte","last_synced_at":"2025-03-25T10:32:13.652Z","repository":{"id":45485265,"uuid":"436611525","full_name":"hyrious/esbuild-plugin-svelte","owner":"hyrious","description":"Minimal efforts to make svelte work in esbuild.","archived":false,"fork":false,"pushed_at":"2025-01-09T09:38:07.000Z","size":215,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-20T01:01:52.183Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyrious.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-09T12:38:02.000Z","updated_at":"2025-01-09T09:38:11.000Z","dependencies_parsed_at":"2024-11-12T04:32:47.697Z","dependency_job_id":null,"html_url":"https://github.com/hyrious/esbuild-plugin-svelte","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"4681eb1bd5b942519e1f753eb3a9fe3985dec476"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyrious%2Fesbuild-plugin-svelte","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyrious%2Fesbuild-plugin-svelte/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyrious%2Fesbuild-plugin-svelte/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyrious%2Fesbuild-plugin-svelte/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyrious","download_url":"https://codeload.github.com/hyrious/esbuild-plugin-svelte/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245444229,"owners_count":20616342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T14:40:27.745Z","updated_at":"2025-03-25T10:32:13.636Z","avatar_url":"https://github.com/hyrious.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @hyrious/esbuild-plugin-svelte\n\nMinimal efforts to make svelte work in esbuild.\n\n## Install\n\n```bash\nnpm add -D @hyrious/esbuild-plugin-svelte svelte esbuild\n```\n\n## Usage\n\n```js\nimport { build } from 'esbuild'\nimport { svelte } from '@hyrious/esbuild-plugin-svelte'\n\nawait build({\n  entryPoints: ['main.js'],\n  bundle: true,\n  plugins: [svelte()],\n}).catch(() =\u003e process.exit(1))\n```\n\n## Options\n\n```js\nsvelte({\n  filter: /\\.svelte(\\?.*)?$/,\n  compilerOptions: {},\n  preprocess: [],\n  emitCss: true,\n  inspector: void 0,\n  dynamicCompileOptions: () =\u003e void 0,\n})\n```\n\n### filter\n\nPassed to esbuild [`onLoad()`](https://esbuild.github.io/plugins/#on-load)\ncallback to match svelte files.\n\n### compilerOptions\n\nSee [svelte/compiler#CompileOptions](https://svelte.dev/docs/svelte/svelte-compiler#CompileOptions).\n\nIf not specified, the `dev` mode is detected with the following logic:\n\n- If either one of the following config is set, `dev: false`.\n  - `minify: true`\n  - `define: { 'process.env.NODE_ENV': '\"production\"' }`\n  - `define: { 'import.meta.env.NODE_ENV': '\"production\"' }`\n  - `define: { 'import.meta.env.DEV': 'false' }`\n- Otherwise, `dev: true`.\n\nIf not specified, the `ssr` mode (`generate: 'server'`) is detected with the following logic:\n\n- If either one of the following config is set, `generate: 'server'`.\n  - `define: { 'import.meta.env.SSR': 'true' }`\n- Otherwise, `generate: 'client'`.\n\n### preprocess\n\nSee [svelte/compiler#Preprocessor](https://svelte.dev/docs/svelte/svelte-compiler#Preprocessor).\n\nYou can opt-in the esbuild-powered TypeScript preprocessor by:\n\n```js\nimport { svelte, typescript } from '@hyrious/esbuild-plugin-svelte'\n\nsvelte({\n  // esbuild will print warnings on the final js, so suppress them here.\n  preprocess: [typescript({ onwarn: false })],\n})\n```\n\n### emitCss\n\nGenerate virtual CSS files. If `true` (by default), it will set svelte compile\noptions `css: 'external'` automatically.\n\n### inspector\n\nEnable svelte inspector during development (see the `dev` logic above).\nYou can set it to `false` to ensure it is not enabled anyway.\n\n### dynamicCompileOptions\n\nA function to update [`compilerOptions`](#compileroptions) before compilation.\n\n```js\nsvelte({\n  dynamicCompileOptions({ filename }) {\n    if (filename.includes('node_modules')) return { runes: false }\n  },\n})\n```\n\n## Credits\n\n- [sveltejs/vite-plugin-svelte](https://github.com/sveltejs/vite-plugin-svelte)\n- [EMH333/esbuild-svelte](https://github.com/EMH333/esbuild-svelte)\n- [rixo/svelte-hmr](https://github.com/sveltejs/svelte-hmr)\n\n## [Changelog](./CHANGELOG.md)\n\n## License\n\nMIT @ [hyrious](https://github.com/hyrious)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyrious%2Fesbuild-plugin-svelte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyrious%2Fesbuild-plugin-svelte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyrious%2Fesbuild-plugin-svelte/lists"}