Files
litmus-fe/webpack/webpack.common.js
2023-05-05 15:00:23 +05:30

51 lines
1.2 KiB
JavaScript

/* eslint-disable */
const path = require('path');
const HtmlPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, '..', 'src', 'index.js'),
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.css', '.scss'],
},
output: {
path: path.join(__dirname, '..', '/dist'),
filename: '[name].[contenthash].js',
publicPath: '/'
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: ['ts-loader']
},
{
test: /\.(js|jsx)$/,
exclude: /nodeModules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.((c|sa|sc)ss)$/i,
use: ['style-loader', 'css-loader', 'sass-loader', 'postcss-loader']
},
{
test: /\.(?:ico|gif|png|jpg|jpeg)$/i,
type: 'asset/resource'
},
{
test: /\.(woff(2)?|eot|ttf|otf|svg|)$/,
type: 'asset/inline'
}
]
},
plugins: [
new HtmlPlugin({
template: path.join(__dirname, "..", "public", "index.html"),
// favicon: './src/favicon.svg'
}),
new CopyPlugin({ patterns: [{ from: './config.js' }] })
]
};