{"id":15044712,"url":"https://github.com/tonyketcham/unplugin-obj","last_synced_at":"2025-10-24T09:30:33.750Z","repository":{"id":57142399,"uuid":"434073777","full_name":"tonyketcham/unplugin-obj","owner":"tonyketcham","description":"Import .obj files as strings 🧵 in Vite, Rollup, Webpack + more","archived":false,"fork":false,"pushed_at":"2022-01-02T08:05:12.000Z","size":119,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T10:34:11.021Z","etag":null,"topics":["nuxt","obj-files","obj-loader","rollup","svelte-cubed","threejs","unplugin","vite","webpack4","webpack5"],"latest_commit_sha":null,"homepage":"","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/tonyketcham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["tonyketcham","antfu"]}},"created_at":"2021-12-02T03:52:04.000Z","updated_at":"2023-02-17T18:54:13.000Z","dependencies_parsed_at":"2022-09-05T18:41:21.284Z","dependency_job_id":null,"html_url":"https://github.com/tonyketcham/unplugin-obj","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/tonyketcham%2Funplugin-obj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyketcham%2Funplugin-obj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyketcham%2Funplugin-obj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyketcham%2Funplugin-obj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tonyketcham","download_url":"https://codeload.github.com/tonyketcham/unplugin-obj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236446697,"owners_count":19150125,"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":["nuxt","obj-files","obj-loader","rollup","svelte-cubed","threejs","unplugin","vite","webpack4","webpack5"],"created_at":"2024-09-24T20:50:56.437Z","updated_at":"2025-10-24T09:30:33.345Z","avatar_url":"https://github.com/tonyketcham.png","language":"TypeScript","readme":"# unplugin-obj\n\n[![NPM version](https://img.shields.io/npm/v/unplugin-obj?color=a1b858\u0026label=)](https://www.npmjs.com/package/unplugin-obj)\n\nAn [`.obj`](https://en.wikipedia.org/wiki/Wavefront_.obj_file) file import plugin for Vite, Rollup, and Webpack; built with [unplugin](https://github.com/unjs/unplugin). This gives you a sweet and simple way to import an `.obj` file as a string to, for example, parse into a mesh in something like [three.js](https://threejs.org/), or do whatever you want with.\n\n## Usage\n\nHere's a simple example which imports an `.obj` file as a string then logs it to the console.\n\n```ts\nimport obj from './models/Lowpoly_tree_sample.obj';\n\nconsole.log(obj);\n\n// ...optionally parse the obj file and create a mesh from it...\n```\n\n\u003e TypeSript \u0026 eslint may yell at you for trying to import a module where one doesn't exist without this plugin, so you can ask it to stop using the above comments before the import\n\n## Install\n\n```bash\npnpm i -D unplugin-obj\n```\n\n## Types\n\nThe most generally compatible way to add type definitions for `.obj` modules is via a `tsconfig.json` file.\n\n```js\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    ...\n    \"types\": [\"unplugin-obj/obj\"]\n  }\n}\n```\n\n### Vite\n\n```ts\n// vite.config.ts\nimport ObjFileImport from 'unplugin-obj/vite';\n\nexport default defineConfig({\n  plugins: [ObjFileImport()],\n});\n```\n\nOptional method to add types w/o `tsconfig`:\n\n```ts\n// vite-env.d.ts\n/// \u003creference types=\"unplugin-obj/obj\" /\u003e\n```\n\nExample: [`playground/`](./playground/)\n\n### Rollup\n\n```ts\n// rollup.config.js\nimport ObjFileImport from 'unplugin-obj/rollup';\n\nexport default {\n  plugins: [ObjFileImport()],\n};\n```\n\n### Webpack\n\n```ts\n// webpack.config.js\nmodule.exports = {\n  /* ... */\n  plugins: [require('unplugin-obj/webpack')()],\n};\n```\n\n### SvelteKit\n\n```ts\n// svelte.config.js\n/* ... */\nimport ObjFileImport from 'unplugin-obj/vite';\n\n/** @type {import('@sveltejs/kit').Config} */\nconst config = {\n  /* ... */\n  kit: {\n    /* ... */\n    vite: {\n      /* ... */\n      plugins: [ObjFileImport()],\n    },\n  },\n};\n\nexport default config;\n```\n\n### Nuxt\n\n```ts\n// nuxt.config.js\nexport default {\n  buildModules: [['unplugin-obj/nuxt']],\n};\n```\n\n\u003e This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)\n\n### Vue CLI\n\n```ts\n// vue.config.js\nmodule.exports = {\n  configureWebpack: {\n    plugins: [require('unplugin-obj/webpack')()],\n  },\n};\n```\n","funding_links":["https://github.com/sponsors/tonyketcham","https://github.com/sponsors/antfu"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonyketcham%2Funplugin-obj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftonyketcham%2Funplugin-obj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonyketcham%2Funplugin-obj/lists"}