rollup-webpack-loader

raw JSON →
1.0.0 verified Mon Apr 27 auth: no javascript maintenance

Webpack loader that runs Rollup on matched files, allowing you to apply Rollup's tree-shaking and plugin ecosystem within a Webpack build pipeline. Version 1.0.0 is the latest and only release, and appears to be in maintenance mode with no recent updates. It combines Rollup for bundling with Webpack for module resolution and loader chaining. Unlike alternatives like @rollup/plugin-url or directly using Rollup, this loader integrates Rollup as a step in Webpack's build process.

error Error: Module parse failed: Unexpected token (1:0)
cause The loader may not transpile ES6+ syntax without proper plugins configured.
fix
Add rollup-plugin-babel to the rollup options.
error Error: Cannot find module 'rollup'
cause Rollup is not installed as a dependency.
fix
Run 'npm install rollup --save-dev' or 'yarn add rollup -D'.
gotcha The loader is not actively maintained; use with caution for modern webpack versions.
fix Consider using @rollup/plugin-url or direct Rollup integration instead.
breaking Webpack >=2 compatibility not tested; loader may not work with webpack 4+.
fix Use webpack 1 or test thoroughly with your webpack version.
gotcha When used with babel-loader, order matters and can break tree-shaking.
fix Use rollup-plugin-babel instead of babel-loader for proper tree-shaking.
npm install rollup-webpack-loader
yarn add rollup-webpack-loader
pnpm add rollup-webpack-loader

Minimal webpack configuration using rollup-webpack-loader with default Rollup options.

// webpack.config.js
import { resolve } from 'path';
export default {
  entry: './src/index.js',
  output: {
    path: resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        use: {
          loader: 'rollup-webpack-loader',
          options: {
            rollup: {
              plugins: []
            }
          }
        }
      }
    ]
  }
};