const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require("copy-webpack-plugin");
const plugins = [
new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),
new HtmlWebpackPlugin(
{
template: './src/index.html',
filename: 'index.html',
chunks: ['main'],
}
),
new CopyWebpackPlugin({
patterns: [
{ from: 'files' }
]
})
];
module.exports = {
entry: {
main: './src/main.ts',
},
output: {
path: path.resolve(__dirname, '..', 'app'),
publicPath: './'
},
plugins: plugins,
module: {
rules: [
{
test: /\.html$/i,
exclude: /node_modules/,
use: ['html-loader']
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
};