Registry / web-framework / rollup-plugin-file

rollup-plugin-file

JSON →
library0.1.1jsnpmunverified

Rollup plugin that allows a file object (e.g., from Gulp) to be used as an entry point, supporting vinyl files with a `base` property. Current version 0.1.1 is an early release with no tests, no updates since 2017, and no maintenance. Differentiates from standard Rollup entry by accepting file objects rather than file paths, primarily for integration with Gulp streams. Likely abandoned; caution advised for production use.

npm install rollup-plugin-file
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-FILE
R
rollup-plugin-file
web-frameworkjavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default
✓ import rollupFile from 'rollup-plugin-file'
✗ const rollupFile = require('rollup-plugin-file').default
Default export, both ESM and CJS work but require .default in commonjs
rollupFile
✓ import rollupFile from 'rollup-plugin-file'
Named export does not exist; only default export is available
plugin
✓ import rollupFile from 'rollup-plugin-file'; // then use in plugins: [rollupFile()]
✗ const rollupFile = require('rollup-plugin-file'); // missing .default
CommonJS users must use .default or use default property

Shows basic usage with Gulp: takes a vinyl file stream and bundles each file using Rollup with the file plugin.

import { rollup } from 'rollup'; import rollupFile from 'rollup-plugin-file'; import gulp from 'gulp'; import through from 'through2'; gulp.task('build', function() { return gulp.src('./src/*.js') .pipe(through.obj(function(file, enc, done) { rollup({ entry: file, plugins: [rollupFile()] }).then(bundle => { file.contents = Buffer.from(bundle.generate({format: 'iie'}).code); done(null, file); }).catch(done); })) .pipe(gulp.dest('./dist')); });
Debug
Known issues
breakingThe package has no tests, no maintenance since 2017, and is likely abandoned.
fix
Consider alternative plugins like @rollup/plugin-url or rollup-plugin-stream
affects: >=0.0.0
gotchaThe entry file must have a `base` property (e.g., vinyl file from Gulp). Using a string path will fail.
fix
Ensure you pass a file object with `base` set, or use gulp-rollup-file wrapper
affects: >=0.0.0
gotchaThe plugin does not support modern Rollup versions (>=1.0.0); it only works with Rollup 0.x.
fix
Use with Rollup 0.x or find alternative for Rollup 1+
affects: >=0.0.0
Errors
Common errors & fixes
Error: The `entry` option must be a string, string array, or an object with a `base` property.
Passing a string path instead of a file object with `base`.
fix
Use a vinyl file object from Gulp or manually add `base` property to the file object.
TypeError: Cannot read property 'resolveId' of undefined
Plugin not included in plugins array or Rollup version incompatible.
fix
Add rollupFile() to plugins array; check Rollup version compatibility (0.x only).
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
rolluprequiredThe plugin is designed to be used with Rollup as a plugin
Agent activity
2 hits · last 30 days
node
2
Resources
rollup-plugin-file — npm install rollup-plugin-file · libregistry