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

66 lines
1.4 KiB
JavaScript

import HtmlWebpackPlugin from 'html-webpack-plugin';
import path from 'path';
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
const __dirname = path.resolve();
const config = {
entry: './src/index.tsx',
output: {
path: path.resolve(__dirname, 'build'),
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',
options: {
modules: {
namedExport: false,
localIdentName: '[local]--[hash:base64:5]',
},
},
},
'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;