EvaluationEfficiencyOptimiz.../front/webpack.config.js

66 lines
1.4 KiB
JavaScript
Raw Normal View History

2024-09-24 20:57:08 +04:00
import HtmlWebpackPlugin from 'html-webpack-plugin';
import path from 'path';
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
const __dirname = path.resolve();
const config = {
2024-10-20 22:28:06 +04:00
entry: './src/index.tsx',
2024-09-24 20:57:08 +04:00
output: {
2024-10-20 22:28:06 +04:00
path: path.resolve(__dirname, 'build'),
2024-09-24 20:57:08 +04:00
filename: 'main.js',
publicPath: '/',
},
devServer: {
historyApiFallback: true,
static: {
directory: path.join(__dirname, 'build'),
},
port: 5000,
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: ['babel-loader'],
},
{
test: /\.module\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
2024-10-20 22:28:06 +04:00
options: {
modules: {
namedExport: false,
localIdentName: '[local]--[hash:base64:5]',
},
},
2024-09-24 20:57:08 +04:00
},
'sass-loader',
],
},
{
test: /\.(scss|css)$/,
exclude: /\.module\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.(svg)$/i,
use: ['@svgr/webpack'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, 'public', 'index.html'),
}),
],
resolve: {
extensions: ['.js', '.ts', '.tsx'],
plugins: [new TsconfigPathsPlugin({})],
},
};
export default config;