2020-08-22 04:57:06 +03:00
|
|
|
import * as path from 'path';
|
|
|
|
import * as webpack from 'webpack';
|
2018-12-21 22:18:05 +03:00
|
|
|
|
2020-08-22 04:57:06 +03:00
|
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
2018-12-21 22:18:05 +03:00
|
|
|
|
|
|
|
module.exports = {
|
2020-08-01 00:32:41 +03:00
|
|
|
mode: isProduction ? 'production' : 'development',
|
2018-12-21 22:18:05 +03:00
|
|
|
entry: [
|
|
|
|
!isProduction && 'webpack-dev-server/client?http://localhost:3000',
|
|
|
|
!isProduction && 'webpack/hot/only-dev-server',
|
2020-08-08 23:26:39 +03:00
|
|
|
'./src/index',
|
2018-12-21 22:18:05 +03:00
|
|
|
].filter(Boolean),
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'dist'),
|
|
|
|
filename: 'bundle.js',
|
2020-08-08 23:26:39 +03:00
|
|
|
publicPath: '/static/',
|
2018-12-21 22:18:05 +03:00
|
|
|
},
|
|
|
|
module: {
|
2020-08-01 00:32:41 +03:00
|
|
|
rules: [
|
2019-01-10 21:51:14 +03:00
|
|
|
{
|
2020-08-22 04:57:06 +03:00
|
|
|
test: /\.(js|ts)x$/,
|
2020-08-01 00:32:41 +03:00
|
|
|
loader: 'babel-loader',
|
2020-08-22 04:57:06 +03:00
|
|
|
exclude: /node_modules/,
|
2020-08-08 23:26:39 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-08-22 04:57:06 +03:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
|
|
},
|
|
|
|
plugins: [new webpack.HotModuleReplacementPlugin()],
|
2020-08-09 08:06:18 +03:00
|
|
|
devServer: {
|
|
|
|
historyApiFallback: true,
|
|
|
|
hot: true,
|
|
|
|
port: 3000,
|
|
|
|
},
|
2020-08-22 04:57:06 +03:00
|
|
|
devtool: 'eval-source-map',
|
2018-12-21 22:18:05 +03:00
|
|
|
};
|