mirror of https://github.com/bpb27/tta-elastic
83 lines
1.7 KiB
JavaScript
83 lines
1.7 KiB
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const WebpackMd5Hash = require('webpack-md5-hash');
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
const CompressionPlugin = require('compression-webpack-plugin');
|
|
|
|
module.exports = {
|
|
entry: {
|
|
main: './src/index.js'
|
|
},
|
|
output: {
|
|
filename: '[name].[hash].js',
|
|
path: path.resolve(__dirname, 'dist'),
|
|
publicPath: '/',
|
|
},
|
|
devServer: {
|
|
contentBase: './dist',
|
|
historyApiFallback: true,
|
|
hot: true,
|
|
open: false,
|
|
},
|
|
devtool: 'source-map',
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
},
|
|
},
|
|
{
|
|
test: /.scss/,
|
|
use: [
|
|
{
|
|
loader: 'style-loader',
|
|
},
|
|
{
|
|
loader: 'css-loader',
|
|
options: {
|
|
localIdentName: '[local]___[hash:base64:5]',
|
|
modules: true,
|
|
sourceMap: false,
|
|
}
|
|
},
|
|
{
|
|
loader: 'sass-loader',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.css/,
|
|
use: [
|
|
{
|
|
loader: 'style-loader',
|
|
},
|
|
{
|
|
loader: 'css-loader',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.(png|jpg|jpeg|gif)$/,
|
|
use: [
|
|
'file-loader',
|
|
],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new CleanWebpackPlugin(),
|
|
new HtmlWebpackPlugin({
|
|
favicon: 'public/favicon.ico',
|
|
filename: 'index.html',
|
|
hash: true,
|
|
inject: false,
|
|
template: './public/index.html',
|
|
}),
|
|
new WebpackMd5Hash(),
|
|
new CompressionPlugin(),
|
|
],
|
|
};
|