2026-07-13 20:08:31 +03:00
|
|
|
import path from 'node:path'
|
|
|
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
|
|
|
|
|
|
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
|
|
|
|
|
|
|
|
const root = path.dirname(fileURLToPath(import.meta.url))
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
entry: './src/main.tsx',
|
|
|
|
|
output: {
|
|
|
|
|
path: path.join(root, 'dist'),
|
|
|
|
|
filename: 'assets/app.[contenthash].js',
|
|
|
|
|
assetModuleFilename: 'assets/[name].[contenthash][ext]',
|
|
|
|
|
clean: true,
|
|
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
extensions: ['.tsx', '.ts', '.js'],
|
2026-07-14 09:54:36 +03:00
|
|
|
alias: {
|
|
|
|
|
react: path.resolve(root, '../../node_modules/react'),
|
|
|
|
|
'react-dom': path.resolve(root, '../../node_modules/react-dom'),
|
|
|
|
|
},
|
2026-07-13 20:08:31 +03:00
|
|
|
},
|
|
|
|
|
module: {
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
|
exclude: /node_modules/,
|
|
|
|
|
use: 'ts-loader',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
test: /\.module\.css$/,
|
|
|
|
|
use: [
|
|
|
|
|
'style-loader',
|
|
|
|
|
{
|
|
|
|
|
loader: 'css-loader',
|
|
|
|
|
options: {
|
|
|
|
|
modules: {
|
|
|
|
|
namedExport: false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
test: /\.css$/,
|
|
|
|
|
exclude: /\.module\.css$/,
|
|
|
|
|
use: ['style-loader', 'css-loader'],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
plugins: [
|
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
|
templateContent: '<!doctype html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>React Webpack sprite fixture</title></head><body><div id="root"></div></body></html>',
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
}
|