{"id":15059397,"url":"https://github.com/ryan-haskell/vite-plugin-elm-watch","last_synced_at":"2025-04-10T05:26:00.726Z","repository":{"id":227360790,"uuid":"723476901","full_name":"ryan-haskell/vite-plugin-elm-watch","owner":"ryan-haskell","description":"Use Elm with Vite (powered by elm-watch!)","archived":false,"fork":false,"pushed_at":"2025-02-14T20:04:57.000Z","size":1175,"stargazers_count":23,"open_issues_count":6,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-06T02:47:34.577Z","etag":null,"topics":["elm","elm-watch","plugin","vite"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ryan-haskell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-11-25T19:42:55.000Z","updated_at":"2025-03-10T14:00:42.000Z","dependencies_parsed_at":"2024-04-05T20:24:27.572Z","dependency_job_id":"eac14884-777b-414d-85ae-951f4c8a2ea6","html_url":"https://github.com/ryan-haskell/vite-plugin-elm-watch","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":0.1428571428571429,"last_synced_commit":"9ba17ef8f914f417c48bbb1cc968a8c525191c3f"},"previous_names":["ryan-haskell/vite-plugin-elm-watch"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryan-haskell%2Fvite-plugin-elm-watch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryan-haskell%2Fvite-plugin-elm-watch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryan-haskell%2Fvite-plugin-elm-watch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryan-haskell%2Fvite-plugin-elm-watch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryan-haskell","download_url":"https://codeload.github.com/ryan-haskell/vite-plugin-elm-watch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248162099,"owners_count":21057699,"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":["elm","elm-watch","plugin","vite"],"created_at":"2024-09-24T22:43:04.359Z","updated_at":"2025-04-10T05:26:00.697Z","avatar_url":"https://github.com/ryan-haskell.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-elm-watch\n\n\u003e __🚨 Warning:__ This plugin is still experimental, and doesn't quite work as intended. Publishing here to share progress and work through minor bugs!\n\nUse [Vite](https://vitejs.dev) and [Elm](https://elm-lang.org) with reliable HMR and full-color error messages!\n\n## Installation\n\n```bash\nnpm install -D vite-plugin-elm-watch\n```\n\n## Usage\n\n```js\n// vite.config.js\nimport { defineConfig } from 'vite'\nimport elm from 'vite-plugin-elm-watch'\n\nexport default defineConfig({\n  plugins: [elm()]\n})\n```\n\n```js\n// In src/main.js\nimport Main from './src/Main.elm'\n\nlet app = Main.init()\n```\n\n## Features\n\n- __Import `*.elm` files__ directly from JavaScript or TypeScript\n- __Reliable HMR__ powered by [_elm-watch_](https://lydell.github.io/elm-watch/)\n- __Full-color__, friendly compiler messages in the browser\n- __Jump to problem__ from your browser in one click\n- __JS minification__ step is included\n- __React output mode__ for easy interop with existing components\n\n### Screenshots\n\n![Vite + Elm working](./docs/screenshot.png)\n\n![Vite + Elm working](./docs/screenshot_error.png)\n\n![Vite + Elm working](./docs/screenshot_error_light.png)\n\n\n## Options\n\n### `mode`\n\nWhen using [the official Elm CLI](https://guide.elm-lang.org/install/elm.html), you have access to flags that can add Elm's time-traveling debugger, or optimize your code for production.\n\nThis plugin also adds a few additional options for minifying compiled code for production and provides nice defaults in development.\n\n```ts\n  'auto'     // Uses \"debug\" in development and \"minify\" in production\n| 'standard' // Doesn't add any Elm compiler flags\n| 'debug'    // Adds the `--debug` flag\n| 'optimize' // Adds the `--optimize` flag\n| 'minify'   // Adds the `--optimize` flag and minifies the JS output\n```\n\n### `output`\n\n```ts\n  'default'  // Exports standard object with \"init\" function\n| 'react'    // Exports a React component that can be dropped into an existing app\n```\n\nThis option allows you to specify what your imported Elm code will return. For React apps, we recommend using the `'react'` output so you can easily swap `.jsx/.tsx` files with `.elm` and things will just work ™️.\n\n__Warning:__ Still working through HMR bugs before this is production ready!\n\n\n### `isBodyPatchEnabled`\n\n```ts\nisBodyPatchEnabled : boolean\n```\n\nIn production, you might encounter issues caused by third party JS that modify the `\u003cbody\u003e` element. This only is a problem for folks using `Browser.application`, which expects control over the entire `\u003cbody\u003e` element.\n\nBy enabling `isBodyPatchEnabled: true`, you'll be able to specify a custom root node. This uses Elm's standard `node` field when initializing the app:\n\n```js\n// src/main.js\nimport Main from './src/Main.elm'\n\nlet app = Main.init({\n  node: document.getElementById('elm_root')\n})\n```\n\n__Note:__ This will only work if the element has an `id` attribute.\n\nA known issue is that Elm will clear out attributes for this root element, so `id=\"elm_root\"` won't be visible after Elm loads.\n\n## Known issues\n\n1. When in a React app, swapping a \".elm\" component with a \".tsx\" will causes issues with unmounting.\n    - React calls `removeChild` internally on the initial DOM node, before our component can run `app.unmount()`. This leads to a runtime exception!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryan-haskell%2Fvite-plugin-elm-watch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryan-haskell%2Fvite-plugin-elm-watch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryan-haskell%2Fvite-plugin-elm-watch/lists"}