Registry / serialization / unplugin-obj

unplugin-obj

JSON →
library0.1.2jsnpmunverified

Import .obj files as strings in Vite, Rollup, Webpack, and more. Version 0.1.2 is the latest stable release. Built on the unplugin framework, it provides seamless integration across multiple build tools with a unified API. The plugin converts .obj files to raw text, enabling use with three.js or custom parsers. It includes TypeScript type declarations and supports SvelteKit, Nuxt, and Vue CLI. Compared to alternatives like raw-loader or asset modules, it offers framework-agnostic zero-config setup and consistent import syntax across bundlers.

npm install unplugin-obj
INSTALL
IMPORT
SIG · UNPLUGIN-OBJ
U
unplugin-obj
serializationjavascriptv0.1.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import obj from './model.obj';
const obj = require('./model.obj');
Default import returns the obj file content as a string. Requires the plugin to be added to your build tool configuration.
ObjFileImport (plugin factory)
import ObjFileImport from 'unplugin-obj/vite';
import ObjFileImport from 'unplugin-obj';
Must import from the tool-specific subpath: /vite, /rollup, /webpack, or /nuxt. Default export from root is not available.
Type reference
/// <reference types="unplugin-obj/obj" />
/// <reference types="unplugin-obj" />
Type declarations are in the 'obj' subpath. Add to a .d.ts file or tsconfig.json types array.

Shows Vite configuration with unplugin-obj and importing an .obj file as a string.

// vite.config.ts import { defineConfig } from 'vite'; import ObjFileImport from 'unplugin-obj/vite'; export default defineConfig({ plugins: [ObjFileImport()], }); // App.ts import obj from './models/Lowpoly_tree_sample.obj'; console.log(obj); // outputs the OBJ file content as a string // Optionally parse with three.js: // import { parseOBJ } from 'three/addons/loaders/OBJLoader.js'; // console.log(parseOBJ(obj));
Debug
Known issues
gotchaTypeScript and ESLint may complain about non-existent .obj modules before the plugin is configured.
fix
Add type declarations via 'unplugin-obj/obj' in tsconfig.json or a reference directive.
affects: >=0.1.0
gotchaThe plugin must be imported from a tool-specific subpath (e.g., 'unplugin-obj/vite'), not the package root.
fix
Use correct import: import ObjFileImport from 'unplugin-obj/vite';
affects: >=0.1.0
gotchaWebpack users must use require() for the plugin in webpack.config.js if using CommonJS.
fix
Use const ObjFileImport = require('unplugin-obj/webpack');
affects: >=0.1.0
breakingVersion 0.x may introduce breaking changes without notice; no stable release yet.
fix
Pin exact version and test updates carefully.
affects: <1.0.0
Errors
Common errors & fixes
Cannot find module 'unplugin-obj' or its corresponding type declarations.
Missing type declarations for .obj files or incorrect import path.
fix
Add 'unplugin-obj/obj' to tsconfig.json types array or add a .d.ts file with /// <reference types="unplugin-obj/obj" />.
Error: The plugin 'unplugin-obj' doesn't provide a default export.
Importing from the package root instead of the tool-specific subpath.
fix
Change import to e.g. import ObjFileImport from 'unplugin-obj/vite';
TypeScript error: Cannot find module './model.obj' or its corresponding type declarations.
TypeScript does not recognize .obj imports without type declarations.
fix
Add type declarations for .obj files (see above).
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
unplugin-obj — npm install unplugin-obj · libregistry