Registry / devops / worklet-loader

worklet-loader

JSON →
library2.0.0jsnpmunverified

Webpack loader that imports scripts as URLs for use with worklet modules (AudioWorklet, PaintWorklet, AnimationWorklet, etc.). Version 2.0.0 is the latest stable release. It is explicitly a fork of worker-loader and the maintainer advises caution as worker-specific behaviors may break worklets. Only works with webpack 3 or 4. No active development; likely obsolete once worker-loader supports worklets natively. Supports inline as Blob, custom filenames, and public path overrides.

npm install worklet-loader
INSTALL
IMPORT
SIG · WORKLET-LOADER
W
worklet-loader
devopsjavascriptv2.0.0
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 export (URL string)
import workletUrl from 'worklet-loader!./worklet.js';
import workletUrl from './worklet.js';
Worklet is loaded via inline loader syntax or webpack config rule. The default export is a string URL or Blob URL.
TypeScript declaration
declare module '*.worklet.ts' { const exportString: string; export default exportString; }
declare module '*.worklet.js' { const exportString: string; export default exportString; }
The declaration must match the file extension used (e.g., .worklet.ts if using TypeScript).
CommonJS require
const workletUrl = require('worklet-loader!./worklet.js');
const workletUrl = require('./worklet.js');
When using require(), you must include the loader prefix.

Configures webpack to process .worklet.js files with worklet-loader, then imports a worklet file and registers it with AudioWorklet.

// webpack.config.js module.exports = { module: { rules: [ { test: /\.worklet\.js$/, use: { loader: 'worklet-loader' } } ] } }; // App.js import workletUrl from './file.worklet.js'; const audioCtx = new AudioContext(); audioCtx.audioWorklet.addModule(workletUrl).then(() => { console.log('Worklet registered'); });
Debug
Known issues
deprecatedPackage is a fork of worker-loader and the author advises against using it. worker-loader may natively support worklets in the future.
fix
Use worker-loader if you need worklet support, or wait for official worklet support.
affects: >=2.0.0
gotchaThe loader only works with webpack 3 or 4. Not compatible with webpack 5.
fix
Use webpack 4 or consider an alternative loader for webpack 5.
affects: >=1.0.0
gotchaWhen using TypeScript, you must declare a module for the worklet files, otherwise TypeScript will not recognize the import.
fix
Add a custom declaration file (e.g., typings/custom.d.ts) with declare module '*.worklet.ts' { const exportString: string; export default exportString; }
affects: >=1.0.0
gotchaThe inline option creates a Blob URL, which may not work in some CSP (Content Security Policy) environments that restrict blob: URLs.
fix
Avoid inline: true if your site has strict CSP, or adjust CSP to allow blob: URLs.
affects: >=1.0.0
Errors
Common errors & fixes
Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type.
The file does not match the test pattern in webpack config, or the loader is not applied.
fix
Ensure your webpack config has a rule with test: /\.worklet\.js$/ and loader: 'worklet-loader'. Or use inline loader syntax: import url from 'worklet-loader!./file.js';
Cannot find module 'worklet-loader'
worklet-loader is not installed as a devDependency.
fix
Run npm install --save-dev worklet-loader
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
webpackrequiredpeer dependency: requires webpack ^3.0.0, ^4.0.0-alpha.0, or ^4.0.0
Agent activity
28 hits · last 30 days
node
24
OpenAI (training)
1
Resources
worklet-loader — npm install worklet-loader · libregistry