-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
32 lines (31 loc) · 1.12 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
module.exports = {
entry: './src/index.tsx',
output: {filename: 'bundle.js', path: path.resolve(__dirname, 'public')},
devServer: {
contentBase: path.resolve(__dirname, 'public'),
open: false,
host: `localhost`,
port: 3000,
historyApiFallback: true
},
module: {
rules: [
{test: /\.js$/i, exclude: /node_modules/, use: 'babel-loader'},
{test: /\.tsx?$/i, exclude: /node_modules/, use: 'ts-loader'},
{test: /\.s[ac]ss$/i, use: [ MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']},
{test: /\.(png|jpe?g|svg)$/i, use: 'file-loader'},
{test: /\.(woff|woff2|eot|ttf|otf)$/i, use: 'file-loader'},
]
},
plugins: [
new MiniCssExtractPlugin({filename: 'bundle.css'})
],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
plugins: [new TsconfigPathsPlugin({configFile: 'tsconfig.json'})]
},
devtool: 'source-map'
};