2022-05-31 22:00:53 +01:00
const path = require ( 'path' ) ;
const TerserPlugin = require ( "terser-webpack-plugin" ) ;
const CssMinimizerPlugin = require ( 'css-minimizer-webpack-plugin' ) ;
const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
2022-06-02 21:16:35 +01:00
const MiniCssExtractPlugin = require ( "mini-css-extract-plugin" ) ;
2022-05-31 22:00:53 +01:00
module . exports = {
mode : "production" ,
cache : false ,
entry : './src/main.tsx' ,
output : {
path : path . resolve ( _ _dirname , 'dist' ) ,
filename : 'bundle.js' ,
} ,
stats : {
colors : true ,
timings : true ,
} ,
performance : {
hints : false ,
} ,
plugins : [
2022-05-31 22:22:46 +01:00
new HtmlWebpackPlugin ( {
title : "Chaos's Food Likes/Dislikes" ,
aseUrl : './' ,
meta : {
'og:title' : { property : 'og:title' , content : "Chaos's Food Likes/Dislikes" } ,
2022-08-04 22:43:08 +01:00
'og:description' : { property : 'og:description' , content : "A list for all the foods I like, dislike and find myself unable to eat due to sensory difficulties." } ,
2022-05-31 22:22:46 +01:00
} ,
2022-06-02 21:16:35 +01:00
} ) ,
new MiniCssExtractPlugin ( ) ,
2022-05-31 22:00:53 +01:00
] ,
devServer : {
historyApiFallback : true ,
} ,
resolve : {
modules : [ 'node_modules' ] ,
extensions : [ '.tsx' , '.ts' , '.js' , ".mjs" ] ,
alias : { os : false }
} ,
module : {
rules : [
{
test : /\.(scss)$/ ,
2022-06-02 21:16:35 +01:00
use : [ MiniCssExtractPlugin . loader , {
2022-05-31 22:00:53 +01:00
loader : 'css-loader' ,
} , {
loader : 'postcss-loader' ,
options : {
postcssOptions : {
options : function ( ) {
return [
require ( 'precss' ) ,
require ( 'autoprefixer' )
] ;
}
}
}
} , {
loader : 'sass-loader'
} ]
} ,
{
test : /\.ts(x?)$/ ,
exclude : /node_modules/ ,
use : [
{
loader : 'ts-loader'
}
]
} ,
] ,
} ,
optimization : {
minimize : true ,
minimizer : [
` ... ` ,
new TerserPlugin ( {
terserOptions : {
ecma : "2015"
}
} ) ,
new CssMinimizerPlugin ( ) ,
] ,
} ,
} ;