Webpack loader that uses Rollup, which calls back into Webpack for module resolution.
Clone or download
Latest commit 80c66b5 Aug 26, 2018
Permalink
Failed to load latest commit information.
test update deps Aug 26, 2018
.gitignore Create .gitignore Feb 4, 2017
.npmignore Create .npmignore Feb 4, 2017
.travis.yml don't test in node 4 Mar 11, 2018
LICENSE Initial commit Feb 4, 2017
README.md cleanup readme Apr 25, 2018
index.js only generate sourcemaps when necessary Mar 11, 2018
package.json update deps Aug 26, 2018

README.md

webpack-rollup-loader Build Status

Webpack loader that uses Rollup, which calls back into Webpack for module resolution.

Inspired by egoist/rollup-loader.

Installation

npm install --save-dev webpack-rollup-loader

Rollup is a peer dependency, and must also be installed:

npm install --save-dev rollup

Usage

Note: This loader must only be applied once to the entry module. Using it to load all .js files (or even just recursively) has undefined behaviour and is likely to produce horrendously incorrect code.

Also, make sure that Babel is not compiling ES6 imports to CommonJS with the transform-es2015-modules-commonjs plugin.

webpack.config.js:

module.exports = {
  entry: 'entry.js',
  module: {
    rules: [
      {
        test: /entry\.js$/,
        use: [{
          loader: 'webpack-rollup-loader',
          options: {
            // OPTIONAL: any rollup options (except `entry`)
            // e.g.
            external: [/* modules that shouldn't be rollup'd */]
          },
        }]
      },

      // ...other rules as usual
      {
        test: /\.js$/,
        use: ['babel-loader'] // can be applied to .js files as usual
      }
    ]
  }
};