benjaminnaesen
6/8/2018 - 11:39 AM

Webpack for Javascript files

Webpack configuration that bundles and uglifies javascript files.

const webpack = require("webpack");
const path = require("path");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");

module.exports = {
	entry: './src/index.js',
	output: {
		filename: '[name].bundle.js',
		path: path.resolve(__dirname, 'dist')
	},
	module: {
		rules: []
	},
	plugins: [new UglifyJSPlugin({sourceMap: true})]
};
"scripts": {
  "run:webpack": "./node_modules/.bin/webpack --watch --mode=development --devtool source-map",
}