[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

94 lines
2.5 KiB

import { Configuration } from 'webpack'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import postcssPresetEnv from 'postcss-preset-env'
import postcssNormalize from 'postcss-normalize'
import PACKAGE from './package.json'
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import c from './config/config.json'
const config: Configuration = {
mode: 'development',
devtool: 'eval-source-map',
entry: {
app: `${__dirname}/src/app.tsx`
},
output: {
path: `${__dirname}/dist`,
publicPath: '/',
filename: '[name].js',
},
optimization: {
splitChunks: {
chunks: 'all',
},
},
devServer: {
contentBase: `${__dirname}/dist`,
historyApiFallback: true,
before: app => {
app.get('/config.json', (_, res) => {
res.json(c)
})
},
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {
src: `${__dirname}/src`,
}
},
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: 'ts-loader',
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
importLoaders: 1,
},
},
{
loader: 'postcss-loader',
options: {
plugins: [
postcssNormalize(),
postcssPresetEnv({
stage: 2,
}),
]
}
}
],
},
{
test: /\.(jpe?g|gif|png|svg)$/,
use: ['file-loader'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
title: 'Flexor',
hash: true,
template: 'src/index.ejs',
templateParameters: {
'version': PACKAGE.version,
},
}),
new MiniCssExtractPlugin({
filename: '[name].css',
}),
// new BundleAnalyzerPlugin(),
],
}
export default config