2022-04-11 09:25:51 -06:00
|
|
|
const path = require('path');
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2022-04-13 10:48:10 -06:00
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
|
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2022-04-11 09:25:51 -06:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: './src/index.js',
|
|
|
|
output: {
|
2022-04-13 10:48:10 -06:00
|
|
|
path: path.resolve(__dirname, 'build'),
|
|
|
|
filename: 'bundle.js',
|
|
|
|
publicPath: '/',
|
2022-04-11 09:25:51 -06:00
|
|
|
},
|
|
|
|
resolve: {
|
2022-04-13 10:48:10 -06:00
|
|
|
extensions: ['.js', '.jsx'],
|
|
|
|
alias: {
|
|
|
|
'@components': path.resolve(__dirname, 'src/components/'),
|
|
|
|
'@styles': path.resolve(__dirname, 'src/styles/'),
|
|
|
|
}
|
2022-04-11 09:25:51 -06:00
|
|
|
},
|
2022-04-13 10:48:10 -06:00
|
|
|
mode: 'production',
|
2022-04-11 09:25:51 -06:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.(js|jsx)$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
2022-04-13 10:48:10 -06:00
|
|
|
},
|
2022-04-11 09:25:51 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
use: [
|
|
|
|
{ loader: 'html-loader' }
|
|
|
|
]
|
2022-04-13 10:48:10 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.s[ac]ss$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
'css-loader',
|
|
|
|
'sass-loader',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2022-04-11 09:25:51 -06:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: './public/index.html',
|
|
|
|
filename: './index.html'
|
2022-04-13 10:48:10 -06:00
|
|
|
}),
|
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: '[name].css'
|
|
|
|
}),
|
|
|
|
new CleanWebpackPlugin(),
|
2022-04-11 09:25:51 -06:00
|
|
|
],
|
2022-04-13 10:48:10 -06:00
|
|
|
optimization: {
|
|
|
|
minimize: true,
|
|
|
|
minimizer: [
|
|
|
|
new CssMinimizerPlugin(),
|
|
|
|
new TerserPlugin(),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|