Registry / devops / rollup-plugin-inline-js

rollup-plugin-inline-js

JSON →
library0.5.0jsnpmunverified

Rollup plugin to inline static assets at build time using inline-js directives. Version 0.5.0 supports Rollup ^2.38.5. It replaces $inline directives in source files, similar to the inline-js CLI. The plugin is maintained but has infrequent updates. Key differentiators: it works as a transform plugin, allowing inline directives directly in source code rather than requiring a separate processing step.

npm install rollup-plugin-inline-js
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-INLI
R
rollup-plugin-inline-js
devopsjavascriptv0.5.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

default
✓ import inline from 'rollup-plugin-inline-js'
✗ const inline = require('rollup-plugin-inline-js')
ESM-only; CommonJS require will not work.
createPlugin
✓ import { createPlugin } from 'rollup-plugin-inline-js'
✗ import createPlugin from 'rollup-plugin-inline-js'
The module exports a function as default; named export createPlugin is also available.
InlineOptions
✓ import type { InlineOptions } from 'rollup-plugin-inline-js'
TypeScript users can import the type for inlineOptions object.

Shows how to configure the plugin in a Rollup config file with include/exclude patterns and inline options.

import inline from 'rollup-plugin-inline-js'; export default { input: 'src/entry.js', output: { file: 'dist/bundle.js', format: 'esm' }, plugins: [ inline({ include: ['*.js'], exclude: ['node_modules/**'], inlineOptions: { /* inline-js-core options */ } }) ] };
Debug
Known issues
breakingUpgrade to rollup@2.38.5 required; older versions incompatible.
fix
Update rollup to ^2.38.5 and plugin to 0.5.0.
affects: <0.5.0
breakingPlugin rewritten in 0.3.0; $inline directives now transform source files instead of using a different mechanism.
fix
Migrate to use $inline directives in source code directly.
affects: <0.3.0
gotchaNode.js >=8 required; older versions may fail.
fix
Use Node.js 8 or later.
affects: >=0.5.0
deprecatedDependencies array deprecated; use include/exclude instead.
fix
Remove dependencies array from plugin options.
affects: >=0.4.0
Errors
Common errors & fixes
Error: The plugin "rollup-plugin-inline-js" is not compatible with this version of Rollup! Expected: ^2.38.5
Rollup version mismatch.
fix
Update rollup to ^2.38.5.
TypeError: inline is not a function
Using CommonJS require() instead of ES import.
fix
Use import inline from 'rollup-plugin-inline-js' (ESM) instead of require().
Error: No configuration found for inline-js
Missing or misconfigured .inline.js file or inlineOptions.
fix
Ensure .inline.js file is present or provide inlineOptions in plugin configuration.
Upgrade
Version history
0.5.0latest on npm
Audit
Dependencies
rolluprequiredPeer dependency; required for plugin to function
Agent activity
5 hits · last 30 days
node
4
Resources
rollup-plugin-inline-js — npm install rollup-plugin-inline-js · libregistry