Laravel Elixir Rollup Integration
raw JSON → 1.1.1 verified Mon Apr 27 auth: no javascript maintenance
Adds Rollup.js support to Laravel Elixir builds. Current version 1.1.1, requires Elixir v6+. This extension allows compiling JavaScript modules with Rollup, supporting custom source/output directories and Rollup config files or inline configuration. It is specific to the Laravel Elixir build system and is not actively maintained (last release 2016). Differentiators: native Elixir integration, no need for Gulp plugins, and supports Rollup's tree-shaking and ES module bundling.
Common errors
error Error: Cannot find module 'laravel-elixir-rollup-official' ↓
cause Package not installed or not in node_modules.
fix
Run npm install laravel-elixir-rollup-official --save-dev in your project root.
error gulp: Task 'default' not found ↓
cause No gulpfile.js configured with Elixir or missing default task.
fix
Create a gulpfile.js with the required elixir setup and run 'gulp' (not 'gulp default').
error TypeError: mix.rollup is not a function ↓
cause The package is not required correctly or Elixir is not the right version.
fix
Ensure you have required 'laravel-elixir-rollup-official' in your gulpfile and that Elixir v6+ is installed.
Warnings
breaking Requires Laravel Elixir v6 or newer. Older versions are incompatible. ↓
fix Upgrade Laravel Elixir to v6+ or use an older version of this package.
gotcha If you provide an array of source files without a custom base directory, the default base directory (resources/assets/js) is still used. Ensure paths are relative to that. ↓
fix Specify a custom base directory as the third argument or prefix paths with './' to use absolute paths.
gotcha The fourth argument is a Rollup config object, not a path to a config file. To use a rollup.config.js file, do not pass the fourth argument. ↓
fix Create rollup.config.js in project root or pass inline config object as fourth argument.
deprecated Package is no longer actively maintained. Consider using Laravel Mix or direct Rollup integration. ↓
fix Migrate to Laravel Mix with @wordpress/scripts or rollup-plugin-laravel-mix.
Install
npm install laravel-elixir-rollup-official yarn add laravel-elixir-rollup-official pnpm add laravel-elixir-rollup-official Imports
- elixir wrong
import elixir from 'laravel-elixir';correctconst elixir = require('laravel-elixir'); - mix.rollup wrong
elixir.rollup('main.js');correctelixir(function(mix) { mix.rollup('main.js'); }); - Rollup config object wrong
elixir(function(mix) { mix.rollup('main.js', null, null, [plugin1, plugin2]); });correctelixir(function(mix) { mix.rollup('main.js', 'public/js', null, { plugins: [...] }); });
Quickstart
// Install: npm install laravel-elixir-rollup-official --save-dev
// In gulpfile.js:
const elixir = require('laravel-elixir');
elixir(function(mix) {
mix.rollup('main.js'); // compiles resources/assets/js/main.js -> public/js/main.js
});
// Run: gulp