{"id":16227803,"url":"https://github.com/akryum/meteor-vite","last_synced_at":"2025-10-08T21:25:45.386Z","repository":{"id":58417269,"uuid":"529358478","full_name":"Akryum/meteor-vite","owner":"Akryum","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-24T13:42:19.000Z","size":503,"stargazers_count":34,"open_issues_count":14,"forks_count":20,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-02-28T19:00:29.505Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Akryum.png","metadata":{"files":{"readme":"README.md","changelog":"changeset-status.json","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":"2022-08-26T18:01:33.000Z","updated_at":"2024-08-19T22:24:46.000Z","dependencies_parsed_at":"2023-10-24T14:36:38.390Z","dependency_job_id":null,"html_url":"https://github.com/Akryum/meteor-vite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akryum%2Fmeteor-vite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akryum%2Fmeteor-vite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akryum%2Fmeteor-vite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akryum%2Fmeteor-vite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Akryum","download_url":"https://codeload.github.com/Akryum/meteor-vite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243992347,"owners_count":20380189,"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-10T12:53:54.085Z","updated_at":"2025-10-08T21:25:40.347Z","avatar_url":"https://github.com/Akryum.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# meteor-vite\n\nUse [Vite](https://vitejs.dev) in your Meteor app! ⚡️\n\n## Roadmap\n\n- [x] Development mode\n- [x] Build\n- [x] Importing non-core Meteor packages\n- [x] Lazy meteor packages\n- [x] Reify support\n  - [x] Named exports\n  - [x] Default exports\n  - [x] Re-exports (named + wildcard)\n  - [x] Re-exports via intermediary variable\n- [x] Code-splitting/Dynamic imports\n- [ ] SSR (not tested)\n- [ ] Starter/demo templates\n  - [x] [Vue 3](/examples/vue) \n    - [Live demo](https://vite-and-vue3.meteorapp.com/)\n  - [x] [Svelte](/examples/svelte)\n  - [x] [React](/examples/react)\n\n## Installation\n\n```sh\nmeteor add vite:bundler \u0026\u0026 meteor npm i -D vite meteor-vite\n```\n\nYou can also install any vite plugin, for example `@vitejs/plugin-vue`:\n\n```sh\nmeteor npm i -D @vitejs/plugin-vue\n```\n\nMake sure to have an import client entry (`meteor.mainModule.client`) in your `package.json`:\n\n```json5\n{\n  \"name\": \"my-app\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"meteor run\",\n    \"build\": \"meteor build ../output/vue --directory\"\n  },\n  \"dependencies\": {\n    \"@babel/runtime\": \"^7.17.9\",\n    \"meteor-node-stubs\": \"^1.2.1\",\n    \"vue\": \"^3.2.37\"\n  },\n  \"devDependencies\": {\n    \"@types/meteor\": \"^1.4.87\",\n    \"@vitejs/plugin-vue\": \"^3.0.3\",\n    \"typescript\": \"^4.6.3\",\n    \"vite\": \"^3.0.9\"\n  },\n  \"meteor\": {\n    \"mainModule\": {\n      \"client\": \"client/main.ts\",\n      \"server\": \"server/main.ts\"\n    },\n    // \"viteConfig\": \"\", // If you want your Vite config to live in another directory (e.g. .tools/vite.config.js), specify that here.\n    \"testModule\": \"tests/main.js\"\n  }\n}\n```\n\nYou can leave your Meteor client entry file empty, but it's necessary to enable Meteor import mode. In the example above, we can create an empty `client/main.ts` file.\n\nCreate a Vite configuration file (`vite.config.js`) in your project root:\n\n```js\nimport { defineConfig } from 'vite'\n\n// Example with Vue\nimport vue from '@vitejs/plugin-vue'\n\nexport default defineConfig({\n  plugins: [\n    vue(),\n  ],\n  // Other vite options here...\n})\n```\n\nAs we don't use a standard Vite `index.html` file, we need to specify an entry point (different from the Meteor one):\n\n```js\nimport { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\n\nexport default defineConfig({\n  plugins: [\n    vue(),\n  ],\n\n  meteor: {\n    clientEntry: 'imports/ui/main.ts',\n  },\n})\n```\n\nYou can then write your code from this entry point and it will be handled by Vite! ⚡️\n\n## Features\n\n### Lazy Loaded Meteor Packages\nMeteor-Vite will automatically detect lazy loaded Meteor packages and import them into your Meteor client's entrypoint.\nThis is necessary to ensure that the Vite bundler has access to your Meteor packages.\n\nThe imported files can safely be committed to your project repository. If you remove the associated package in the \nfuture, simply remove the import statement.\n\nOur detection for these packages is fairly primitive, so it's best to keep the imports in the Meteor client \nentrypoint as specified in the `meteor.mainModule.client` field of your `package.json` file.\n```json5\n{\n  \"meteor\": {\n    \"mainModule\": {\n      \"client\": \"client/main.ts\", // Lazy loaded packages are checked for and added here.\n      \"server\": \"server/main.ts\"\n    }\n  }\n}\n```\n\n### Stub validation\nRuntime validation at the client is performed for Meteor packages that are compiled by Vite. This is done to avoid a \nsituation where Meteor-Vite incorrectly exports undefined values from a Meteor Package. Which can lead to silently \nbroken Meteor packages.\n\nThe validation is done simply through verifying that package exports do not have a `typeof` value of `undefined`.\nIf you do have a package that intentionally has `undefined` exports, you can disable the warning message for this \npackage by excluding it in your Meteor settings.json file;\n```ts\n// vite.config.ts\n\nimport type { MeteorViteConfig } from 'meteor-vite'\n\nexport default defineConfig({\n  // ...\n\n  meteor: {\n    clientEntry: 'imports/ui/main.ts',\n    stubValidation: {\n      /**\n       * list of packages to ignore export validation for.\n       */\n      ignorePackages: ['ostrio:cookies'],\n\n      /**\n       * Will only emit warnings in the console instead of throwing an exception that may prevent the client app\n       * from loading.\n       */\n      warnOnly: true,\n\n      /**\n       * Set to true to completely disable stub validation. Any of the above options will be ignored.\n       * This is discuraged as `warnOnly` should give you an important heads up if something might be wrong with Meteor-Vite\n       */\n      disabled: false,\n    }\n  } satisfies MeteorViteConfig['meteor'],\n})\n```\n\n## Package Details\nThe Vite integration comes with two dependencies that work together to enable compatibility between Meteor and Vite.\n\n- [`meteor-vite`](/npm-packages/meteor-vite/) - Internal Vite plugin and server worker parsing and formatting Meteor packages for Vite.\n  - [View changelog](/npm-packages/meteor-vite/CHANGELOG.md)\n  - [View on npm](https://www.npmjs.com/package/meteor-vite)\n\n- [`vite-bundler`](/packages/vite-bundler/) - Meteor build plugin for launching Vite workers and compiling production bundles from Vite and Meteor.\n  - [View changelog](/packages/vite-bundler/CHANGELOG.md) \n  - [View on Atmosphere](https://atmospherejs.com/vite/bundler)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakryum%2Fmeteor-vite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakryum%2Fmeteor-vite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakryum%2Fmeteor-vite/lists"}