psi/webpack.config.js
2021-03-03 22:16:10 +01:00

47 lines
1009 B
JavaScript

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
mode: 'development',
entry: {
index: './src/index.ts',
styles: './src/styles/main.scss',
},
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: "css-loader" },
{ loader: 'postcss-loader' },
{ loader: 'sass-loader' },
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.ejs'
}),
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
})
],
resolve: {
extensions: [ '.ts', '.js' ],
},
output: {
filename: 'scripts.[contenthash].js',
path: path.resolve(__dirname, 'dist'),
clean: true,
},
};