1 | const webpack = require('webpack');
|
2 | const nodeExternals = require('webpack-node-externals');
|
3 | const NodemonPlugin = require('nodemon-webpack-plugin');
|
4 | const path = require('path');
|
5 |
|
6 | const config = {
|
7 | entry: './src/index.js',
|
8 | target: 'node',
|
9 | externals: [nodeExternals()],
|
10 | output: {
|
11 | path: path.resolve(__dirname, './bin'),
|
12 | filename: 'main.js',
|
13 | },
|
14 | module: {
|
15 | rules: [
|
16 | {
|
17 | test: /\.js$/,
|
18 | use: 'babel-loader',
|
19 | exclude: /node_modules/,
|
20 | },
|
21 | ],
|
22 | },
|
23 | resolve: {
|
24 | extensions: ['.js'],
|
25 | },
|
26 | plugins: [
|
27 | new NodemonPlugin(),
|
28 | new webpack.BannerPlugin({
|
29 | banner: '#!/usr/bin/env node',
|
30 | raw: true,
|
31 | }),
|
32 | ],
|
33 | };
|
34 |
|
35 | module.exports = config;
|