[
'base',
'js',
'fonts',
'stats',
'devtool',
'dev_server'
].map( ( x ) => `./${x}` )
.forEach( require )
webpkr
configurations can be split into multiple files. Simply require
the parts like any other nodejs module.
[
'base',
'js',
'fonts',
'stats',
'devtool',
'dev_server'
].map( ( x ) => `./${x}` )
.forEach( require )
context( projectDir )
entry( './src/index.js' )
output( () => {
filename( 'bundle.js' )
path$( 'dist' )
} )
stats( 'errors-only' )
cache( true )
resolve( { extensions: ['*', '.js', '.jsx'] } )
const path = require( 'path' )
module$( () => {
rule( () => {
test( /\.js$/ )
use( 'babel-loader' )
include( path.resolve( srcDirs.js ) )
exclude( /node_modules/ )
} )
} )
Create a webpack.config.js
in your project’s root and add:
const webpkr = require('webpkr');
module.exports = webpkr({projectDir: __dirname});