69 lines
1.7 KiB
JavaScript
69 lines
1.7 KiB
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
|
|
module.exports = {
|
|
entry: {
|
|
app: path.join(__dirname, 'src', 'Application.tsx')
|
|
},
|
|
target: 'web',
|
|
resolve: {
|
|
extensions: ['.ts', '.tsx', '.js']
|
|
},
|
|
module: {
|
|
rules: [{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/
|
|
}, {
|
|
test: /\.css$/i,
|
|
use: ['style-loader', 'css-loader'],
|
|
}, {
|
|
test: /\.(png|jpe?g|gif|svg)$/i,
|
|
type: 'asset/resource',
|
|
generator: {
|
|
filename: '[name][ext]'
|
|
}
|
|
}, {
|
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
type: 'asset/resource',
|
|
},
|
|
],
|
|
},
|
|
devtool: 'source-map',
|
|
output: {
|
|
filename: '[name].[contenthash].js',
|
|
path: path.resolve(__dirname, 'dist'),
|
|
clean: true,
|
|
publicPath: '/'
|
|
},
|
|
optimization: {
|
|
splitChunks: {
|
|
chunks: 'all',
|
|
},
|
|
},
|
|
devServer: {
|
|
client: {
|
|
overlay: {
|
|
errors: true,
|
|
warnings: false,
|
|
runtimeErrors: false,
|
|
},
|
|
},
|
|
historyApiFallback: true,
|
|
static: path.join(__dirname, "dist"),
|
|
compress: true,
|
|
port: 8888,
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: path.join(__dirname, 'src', 'index.html')
|
|
}),
|
|
new CopyWebpackPlugin({
|
|
patterns: [
|
|
{ from: 'src/favicon.png', to: 'favicon.png' }
|
|
]
|
|
})
|
|
]
|
|
}
|