This is the webpack block providing webpack 1.x core functionality. Also provides all @webpack-blocks/core exports for convenience.
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { addPlugins, createConfig, entryPoint, env, setOutput, sourceMaps, webpack } = require('@webpack-blocks/webpack')
module.exports = createConfig([
entryPoint('./src/main.js'),
setOutput('./build/bundle.js'),
addPlugins([
new HtmlWebpackPlugin({
inject: true,
template: './index.html'
}),
new webpack.DefinePlugin({
'process.env': JSON.stringify(process.env || 'development')
})
]),
env('development', [
// will only enable source maps if `NODE_ENV === 'development'`
sourceMaps()
])
])Takes an array of config setters (the functions returned by invoked webpack blocks), invokes them and returns the resulting webpack config object.
Applies an array of webpack blocks only if process.env.NODE_ENV matches the given envName. If no NODE_ENV is set, it will be treated as 'development'.
Same as require('webpack').
Check out the
Released under the terms of the MIT license.