webpack-rollup-loader
v0.8.1
Published
Webpack loader that uses Rollup, which calls back into Webpack for module resolution.
Downloads
191
Readme
webpack-rollup-loader
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 just recursively) will produce incorrect code.
If you use Babel, make sure that it isn't converting ES6 imports to CommonJS.
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
}
]
}
};