1/* global process */
2const webpack = require('webpack');
3const path = require('path');
4
5// fix for https://github.com/webpack/webpack/issues/2537
6if (process.argv.indexOf('-p') !== -1) {
7    process.env.NODE_ENV = 'production';
8}
9
10module.exports = {
11    entry: './script/main.js',
12    output: {
13        path: path.resolve(__dirname, 'lib/'),
14        filename: 'bundle.js',
15    },
16    module: {
17        rules: [
18            {
19                loader: 'eslint-loader',
20                enforce: 'pre',
21                options: {
22                    fix: true,
23                },
24            },
25            {
26                loader: 'babel-loader',
27            },
28        ],
29    },
30    plugins: [
31        new webpack.NoEmitOnErrorsPlugin(),
32    ],
33};
34