old.nicco.io/webpack.config.js

65 lines
1.7 KiB
JavaScript
Raw Normal View History

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')
2019-08-30 20:21:32 +02:00
const CopyPlugin = require('copy-webpack-plugin')
2019-03-03 16:13:57 +01:00
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'],
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-08-30 20:21:32 +02:00
new CopyPlugin([
{ from: 'Static/robots.txt', to: '.' },
]),
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
}