2019-03-03 16:13:57 +01:00
|
|
|
const path = require('path')
|
|
|
|
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: [
|
2019-08-24 09:59:59 +02:00
|
|
|
'./index.tsx',
|
2019-03-03 16:13:57 +01:00
|
|
|
],
|
|
|
|
output: {
|
|
|
|
filename: 'bundle.js',
|
2019-08-24 09:59:59 +02:00
|
|
|
path: path.resolve(__dirname, 'public'),
|
2019-03-03 16:13:57 +01:00
|
|
|
},
|
|
|
|
resolve: {
|
2019-08-24 09:59:59 +02:00
|
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
|
|
alias: {
|
|
|
|
'react': 'preact/compat',
|
|
|
|
'react-dom': 'preact/compat',
|
|
|
|
},
|
2019-03-03 16:13:57 +01:00
|
|
|
},
|
|
|
|
context: path.resolve(__dirname, 'src'),
|
|
|
|
devServer: {
|
|
|
|
contentBase: path.resolve(__dirname, 'public/assets'),
|
2019-08-24 09:59:59 +02:00
|
|
|
historyApiFallback: true,
|
|
|
|
open: false,
|
2019-03-03 16:13:57 +01:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({
|
2019-08-24 09:59:59 +02:00
|
|
|
template: 'index.html',
|
2019-03-03 16:13:57 +01:00
|
|
|
}),
|
|
|
|
new MiniCssExtractPlugin({
|
2019-08-24 09:59:59 +02:00
|
|
|
filename: 'bundle.css',
|
|
|
|
}),
|
2019-03-03 16:13:57 +01:00
|
|
|
],
|
|
|
|
stats: {
|
2019-08-24 09:59:59 +02:00
|
|
|
assets: true,
|
|
|
|
assetsSort: 'size',
|
|
|
|
all: false,
|
|
|
|
errors: true,
|
|
|
|
colors: true,
|
|
|
|
performance: true,
|
|
|
|
timings: true,
|
|
|
|
},
|
2019-03-03 16:13:57 +01:00
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
loader: 'awesome-typescript-loader',
|
2019-08-24 09:59:59 +02:00
|
|
|
}, {
|
2019-03-03 16:13:57 +01:00
|
|
|
test: /\.css$/,
|
2019-08-24 09:59:59 +02:00
|
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
2019-03-03 16:13:57 +01:00
|
|
|
}, {
|
|
|
|
test: /\.styl$/,
|
|
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'stylus-loader'],
|
|
|
|
}, {
|
2019-03-24 13:21:24 +01:00
|
|
|
test: /\.(jpg|png|gif|svg|woff2?|ttf|eot|svg|otf|ico|webmanifest)$/,
|
2019-03-03 16:13:57 +01:00
|
|
|
use: [{
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: '[name].[ext]',
|
2019-03-24 13:21:24 +01:00
|
|
|
outputPath: './',
|
2019-03-03 16:13:57 +01:00
|
|
|
},
|
|
|
|
}],
|
2019-08-24 09:59:59 +02:00
|
|
|
}],
|
|
|
|
},
|
2019-03-03 16:13:57 +01:00
|
|
|
}
|