{"id":22979,"library":"webpack-rollup-loader","title":"webpack-rollup-loader","description":"A Webpack loader that delegates module bundling to Rollup while using Webpack's own module resolution. Version 0.8.1 is the latest stable release, with no active development since 2020. It requires both webpack >=3.3.0 and rollup ^1.0.0 || ^2.0.0. Key differentiator: combines Rollup's tree-shaking and ES module optimizations with Webpack's plugin ecosystem and code splitting. Best suited for project entry points where Rollup's bundling is desired but full migration is impractical. Not for general .js files due to recursive bundling issues.","status":"maintenance","version":"0.8.1","language":"javascript","source_language":"en","source_url":"https://github.com/erikdesjardins/webpack-rollup-loader","tags":["javascript","webpack"],"install":[{"cmd":"npm install webpack-rollup-loader","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-rollup-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-rollup-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for loader interface","package":"webpack","optional":false},{"reason":"peer dependency - core bundling engine","package":"rollup","optional":false}],"imports":[{"note":"This is a Webpack loader, not a JavaScript module for direct import.","wrong":"import webpackRollupLoader from 'webpack-rollup-loader'","symbol":"default import","correct":"No direct import; configured in Webpack config as a loader"},{"note":"Must only be applied to the entry module, not to all .js files.","wrong":"module.exports = { module: { rules: [ { test: /\\.js$/, use: [{ loader: 'webpack-rollup-loader' }] } ] } }","symbol":"Webpack rule for loader","correct":"module.exports = { module: { rules: [ { test: /entry\\.js$/, use: [{ loader: 'webpack-rollup-loader' }] } ] } }"}],"quickstart":{"code":"// webpack.config.js\nconst path = require('path');\n\nmodule.exports = {\n  entry: './src/entry.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js'\n  },\n  module: {\n    rules: [\n      {\n        test: /entry\\.js$/,\n        use: [\n          {\n            loader: 'webpack-rollup-loader',\n            options: {\n              external: ['lodash']\n            }\n          }\n        ]\n      },\n      {\n        test: /\\.js$/,\n        exclude: /entry\\.js$/,\n        use: ['babel-loader']\n      }\n    ]\n  }\n};","lang":"javascript","description":"Configures Webpack to use webpack-rollup-loader on the entry file only, with Rollup options and Babel for other JS files."},"warnings":[{"fix":"Use test: /entry\\.js$/ or similar to target only the entry point.","message":"Loader must only be applied once to the entry module. Applying it to all .js files will produce incorrect code.","severity":"breaking","affected_versions":"all"},{"fix":"In Babel config, disable @babel/plugin-transform-modules-commonjs or set modules: false.","message":"If using Babel, ensure it does not convert ES6 imports to CommonJS. Otherwise, Rollup will not be able to analyze the module graph.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider alternative loaders like rollup-loader or migrate fully to Rollup or Webpack 5 native features.","message":"Package is in maintenance mode with no releases since 2020. Not compatible with Webpack 5 without additional adjustments.","severity":"deprecated","affected_versions":">=0.8.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Restrict the loader to the entry module only using test: /entry\\.js$/.","cause":"The loader was applied to multiple modules or recursively.","error":"Module build failed: Error: This loader must be used only once per entry module"},{"fix":"Set modules: false in Babel config for files processed by Rollup.","cause":"Babel converts ES modules to CommonJS before Rollup processes them, preventing tree-shaking.","error":"Error: Unexpected token: keyword (const). You may need an appropriate loader to handle this file type."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}