const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); module.exports = { entry: './src/index.tsx', output: { filename: 'bundle.[contenthash].js', path: path.resolve(__dirname, 'dist'), clean: true, }, module: { rules: [ { test: /\.[jt]sx?$/, exclude: /node_modules/, use: { loader: 'babel-loader', }, }, { test: /\.css$/i, use: ['style-loader', 'css-loader'], }, { test: /\.svg$/i, issuer: /\.[jt]sx?$/, use: ['@svgr/webpack'], }, { test: /\.svg$/i, type: 'asset/resource', issuer: { not: [/\.[jt]sx?$/] }, }, ], }, plugins: [ new HtmlWebpackPlugin({ template: path.resolve(__dirname, 'src/index.html'), favicon: false, }), new CopyWebpackPlugin({ patterns: [ { from: path.resolve(__dirname, 'node_modules/pdfjs-dist/wasm'), to: 'pdfjs/wasm', }, ], }), ], devServer: { static: [ { directory: path.join(__dirname, 'public'), }, { directory: path.resolve(__dirname, 'node_modules/pdfjs-dist/wasm'), publicPath: '/pdfjs/wasm', watch: false, }, ], compress: true, port: 5173, historyApiFallback: true, open: true, proxy: [ { context: ['/api', '/download'], target: process.env.API_PROXY_PASS, changeOrigin: true, secure: false, }, ], }, devtool: 'source-map', resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'], }, };