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.
51 lines
1.2 KiB
51 lines
1.2 KiB
const path = require('path'); |
|
const glob = require('glob'); |
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin'); |
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); |
|
const PurgecssPlugin = require('purgecss-webpack-plugin'); |
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); |
|
|
|
module.exports = { |
|
entry: './src/app.ts', |
|
module: { |
|
rules: [ |
|
{ |
|
test: /\.tsx?$/, |
|
use: 'ts-loader', |
|
exclude: /node_modules/, |
|
}, |
|
{ |
|
test: /\.css$/i, |
|
use: [MiniCssExtractPlugin.loader, "css-loader"], |
|
}, |
|
{ |
|
test: /\.(png|jpg|jpeg|gif)$/i, |
|
type: "asset/resource", |
|
}, |
|
], |
|
}, |
|
resolve: { |
|
extensions: ['.tsx', '.ts', '.js'], |
|
plugins: [new TsconfigPathsPlugin({})] |
|
}, |
|
output: { |
|
filename: '[name].js', |
|
path: path.resolve(__dirname, './www/'), |
|
clean: true, |
|
}, |
|
plugins: [ |
|
new HtmlWebpackPlugin({ |
|
template: './src/index.html', |
|
hash: true |
|
}), |
|
new MiniCssExtractPlugin({ |
|
filename: "[name].css", |
|
}), |
|
new PurgecssPlugin({ |
|
paths: glob.sync('./src/**/*', { nodir: true }), |
|
safelist: ['html', 'body'] |
|
}) |
|
] |
|
};
|
|
|