johnny-cli
Version:
CLI for Johnny Deps
54 lines (44 loc) • 1.07 kB
JavaScript
// Separate section for imports
const
BannerPlugin = require('banner-webpack-plugin'),
nodeExternals = require('webpack-node-externals'),
path = require('path'),
webpack = require('webpack');
const
isProduction = env => env.environment === 'production';
module.exports = env => (() => ({
cache : !isProduction(env),
target : 'node',
context: path.resolve(__dirname),
stats : {colors: true},
entry: {
johnny: ['../src'],
},
module: {
rules: [
{
test : /\.js$/,
loader : 'babel-loader',
exclude: /node_modules/,
query : require('./babel'),
},
],
},
externals: [nodeExternals({whitelist: ['webpack/hot/poll?1000']})],
output: {
path : path.resolve(__dirname, '..', 'build'),
chunkFilename: '[name]-[chunkhash].js',
filename : '[name].js',
pathinfo : !isProduction(env),
},
plugins: [
new webpack.BannerPlugin({banner: '#!/usr/bin/env node', raw: true}),
],
resolve: {
extensions: ['.json', '.js'],
modules: [
path.resolve(__dirname, '..', 'src'),
'node_modules',
],
},
}))();