import HtmlWebpackPlugin from 'html-webpack-plugin'; import path from 'path'; import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'; const __dirname = path.resolve(); const config = { entry: './routers/index.tsx', output: { path: path.resolve(__dirname, 'dist'), 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 } }, }, '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;