sejm-calculator/webpack.config.ts

69 wiersze
1.4 KiB
TypeScript
Czysty Zwykły widok Historia

2022-05-10 13:11:41 +00:00
/* eslint-disable import/no-extraneous-dependencies */
2019-08-29 17:07:09 +00:00
import path from 'path';
2020-10-18 19:06:38 +00:00
import ESLintPlugin from 'eslint-webpack-plugin';
2019-08-29 17:07:09 +00:00
import HtmlWebpackPlugin from 'html-webpack-plugin';
import LiveReloadPlugin from 'webpack-livereload-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import StyleLintPlugin from 'stylelint-webpack-plugin';
export default {
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/,
use: 'pug-loader',
},
{
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',
}),
new ESLintPlugin({
files: ['./*.[jt]s', './src/**/*.[jt]s'],
2019-08-29 17:07:09 +00:00
}),
new StyleLintPlugin({
configFile: path.resolve(__dirname, '.stylelintrc.json'),
context: path.resolve(__dirname, './src'),
files: '**/*.css',
}),
new LiveReloadPlugin({
2020-10-18 19:06:38 +00:00
appendScriptTag: true,
2019-08-29 17:07:09 +00:00
}),
],
};