Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import 'babel-polyfill';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import BrowserSyncPlugin from 'browser-sync-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import UglifyJsPlugin from 'uglifyjs-webpack-plugin';
import GitRevisionPlugin from 'git-revision-webpack-plugin';
import webpack from 'webpack';
const env = process.env.NODE_ENV || 'development';
const port = process.env.PORT || 4444;
const gitRevisionPlugin = new GitRevisionPlugin({ lightweightTags: true });
const config = {
entry: {
index: [
'./src/client/js/index.js',
'./src/client/css/main.scss',
],
},
output: {
path: `${__dirname}/public/static/`,
filename: (env === 'production') ? 'bundle-[hash].js' : 'bundle.js',
publicPath: '/',
},
module: {
rules: [
{ test: /\.html$/, use: 'html-loader?minimize=false' },
config.plugin('extract')
.use(MiniCssExtractPlugin, [{
filename: '[name].css',
}]);
config.plugin('copy')
.use(CopyWebpackPlugin, [[
{
from: src.common('icons', '*.png'),
flatten: true,
},
], {
copyUnmodified: true,
}]);
const revision = new GitRevisionPlugin();
config.plugin('revision')
.use(revision);
config.plugin('define')
.after('revision')
.use(DefinePlugin, [{
COMMITHASH: JSON.stringify(revision.commithash()),
}]);
config.plugin('notifier')
.use(NotifierPlugin, [{
title: 'Tickety-Tick Build',
}]);
config.devtool('source-map');