Bundle javascript modules with webpack in your GobbleJS workflow.
Yeah, you can already use gobble-browserify
and gobble-rollup
to bundle up your files. But if you need the webpack flavour, this is the tool to use.
I assume you already know the basics of Gobble.
npm i -D gobble-webpack
In your gobblefile
, run the webpack
gobble transform, specifying at least the entry
option, like so:
var gobble = require( 'gobble' );
module.exports = gobble( directory_with_a_javascript_package )
.transform( 'webpack', {entry: './index.js'} );
The options passed to this gobble transform can be those in a webpack config object. Just make sure to omit the context directory and the output path, as these are handled by gobble.
Aditionally, a sourceMap
option is available. This is just a shorthand for a
sensible way to make gobble-compatible sourcemaps. The following:
gobble( somewhere ).transform( 'webpack', {
entry: './index.js',
sourceMap: true
} );
is equivalent to:
gobble( somewhere ).transform( 'webpack', {
entry: './index.js',
output: {
sourceMapFilename: '[file].map',
devtool: 'source-map'
}
} );
"THE BEER-WARE LICENSE":
<[email protected]> wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return.