{"id":27500,"library":"uint8array-loader","title":"uint8array-loader","description":"Webpack loader that returns file content as a Uint8Array, useful for loading binary files (e.g., FlatBuffers schemas) in webpack bundles. Current stable version is 1.0.2, with no recent releases. It is designed to be used with babel-loader, but actually works as a standalone loader. Unlike raw-loader or file-loader, this loader returns an actual Uint8Array object instead of a string or URL. The package has minimal dependencies and is intended for webpack projects needing binary data in array buffer form.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/jcgertig/uint8array-loader","tags":["javascript","unit8","unit8array","binary","binary file","babel","babel-loader","flatbuffers"],"install":[{"cmd":"npm install uint8array-loader","lang":"bash","label":"npm"},{"cmd":"yarn add uint8array-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add uint8array-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the loader runs as a webpack loader.","package":"webpack","optional":false}],"imports":[{"note":"The loader exports the content as a default export; named imports will not work.","wrong":"import { data } from './file.bfbs';","symbol":"default","correct":"import data from './file.bfbs';"},{"note":"CommonJS require also works, returning the Uint8Array.","wrong":"","symbol":"require","correct":"const data = require('./file.bfbs');"},{"note":"TypeScript users may need type assertion; the loader does not ship types, but the result is always Uint8Array.","wrong":"","symbol":"Uint8Array (type)","correct":"import type { Uint8Array } from './file.bfbs';"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.bfbs$/,\n        use: 'uint8array-loader'\n      }\n    ]\n  }\n};\n\n// app.js\nimport binaryData from './schema.bfbs';\nconsole.log(binaryData instanceof Uint8Array); // true\nconsole.log(binaryData.byteLength);\n","lang":"javascript","description":"Shows how to configure webpack to use uint8array-loader for .bfbs files and import the binary content as a Uint8Array."},"warnings":[{"fix":"Import the loader as 'uint8array-loader' (note the typo).","message":"The package name is misspelled 'unit8array' but the export returns 'Uint8Array' correctly.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure webpack is installed; remove babel-loader if not used.","message":"This loader does not work with webpack 5 out of the box if babel-loader is not installed, as it lists babel as a dependency but actually not required.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"If you need a string, convert using TextDecoder or use raw-loader instead.","message":"Loader returns Uint8Array, which may not be expected if you are used to raw-loader returning a string.","severity":"breaking","affected_versions":"all"},{"fix":"Consider using asset modules in webpack 5 to load binary data.","message":"The package has not been updated since 2018 and may have compatibility issues with modern webpack versions.","severity":"deprecated","affected_versions":">=1.0"},{"fix":"Fork the package or use an alternative loader.","message":"The loader's repository URL in npm points to a 404 page; it is unmaintained.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev uint8array-loader' to install it.","cause":"The loader package is not installed or listed in devDependencies.","error":"Module not found: Error: Can't resolve 'uint8array-loader'"},{"fix":"Ensure you are using webpack 4 and that the loader is applied as a rule, not as a plugin.","cause":"The loader is being used without webpack, or the loader version is incompatible with the webpack version.","error":"TypeError: (intermediate value).call is not a function"},{"fix":"Use webpack 4 or switch to asset modules for binary files.","cause":"Webpack 5 removed loader options via this.getOptions; this loader expects an older webpack API.","error":"Cannot read property 'getOptions' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}