2019-08-29 17:07:09 +00:00
|
|
|
import path from 'path';
|
|
|
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
|
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
|
|
|
|
|
|
export default {
|
2023-08-19 21:32:51 +00:00
|
|
|
target: 'web',
|
2019-08-29 17:07:09 +00:00
|
|
|
entry: './src/index.ts',
|
|
|
|
output: {
|
|
|
|
filename: 'bundle.js',
|
|
|
|
path: path.resolve(__dirname, 'dist'),
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.js', '.json'],
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.ts$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: 'babel-loader',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.pug$/,
|
|
|
|
exclude: /node_modules/,
|
2023-08-19 21:32:51 +00:00
|
|
|
use: '@webdiscus/pug-loader',
|
2019-08-29 17:07:09 +00:00
|
|
|
},
|
2023-10-10 10:16:45 +00:00
|
|
|
{
|
|
|
|
test: /\.svg$/,
|
|
|
|
type: 'asset/resource',
|
|
|
|
generator: {
|
|
|
|
filename: (name: {filename: string}) => {
|
|
|
|
const filePath = name.filename.split('/').slice(1, -1).join('/');
|
|
|
|
return `${filePath}/[name][ext]`;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2019-08-29 17:07:09 +00:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: MiniCssExtractPlugin.loader,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {importLoaders: 1},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
},
|
|
|
|
],
|
2020-10-18 19:06:38 +00:00
|
|
|
},
|
|
|
|
],
|
2019-08-29 17:07:09 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({
|
2019-09-25 18:50:54 +00:00
|
|
|
template: './src/templates/index.pug',
|
2019-08-29 17:07:09 +00:00
|
|
|
}),
|
|
|
|
new MiniCssExtractPlugin({
|
2020-10-18 19:06:38 +00:00
|
|
|
filename: '[name].css',
|
|
|
|
chunkFilename: '[id].css',
|
|
|
|
}),
|
2019-08-29 17:07:09 +00:00
|
|
|
],
|
2023-08-19 21:32:51 +00:00
|
|
|
devServer: {
|
|
|
|
watchFiles: ['src/**/*'],
|
2023-09-24 16:33:49 +00:00
|
|
|
client: {
|
2023-10-10 10:16:45 +00:00
|
|
|
overlay: false,
|
2023-09-24 16:33:49 +00:00
|
|
|
},
|
2023-08-19 21:32:51 +00:00
|
|
|
},
|
2019-08-29 17:07:09 +00:00
|
|
|
};
|