127.0.0.1:8000 watch-together / master webpack / createBuild.js
master

Tree @master (Download .tar.gz)

createBuild.js @masterraw · history · blame

/* Author: Seva Luchianov */

const _ = require('lodash');
const path = require('path');
const utils = require('./utils');
const Webpack = require('webpack');
const {
    CleanWebpackPlugin
} = require('clean-webpack-plugin');

module.exports = function() {
    return _.merge({}, require('./config.js'), {
        output: {
            path: path.resolve(__dirname, '../dist')
        },
        plugins: [
            new Webpack.DefinePlugin({
                'process.env': {
                    backgroundMessages: JSON.stringify(
                        utils.getEntriesInFolder(global.JS_ROOT + "websocket/messages").map(([, entry]) => entry.slice(0, -3))
                    )
                }
            }),
            new CleanWebpackPlugin()
        ]
    });
};