2020-09-10 18:45:02 +03:00
|
|
|
import * as path from 'path';
|
|
|
|
import * as webpack from 'webpack';
|
2018-12-22 17:20:04 +03:00
|
|
|
|
|
|
|
module.exports = {
|
2020-09-10 18:45:02 +03:00
|
|
|
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
|
2018-12-22 17:20:04 +03:00
|
|
|
entry: [
|
|
|
|
'webpack-dev-server/client?http://localhost:3000',
|
|
|
|
'webpack/hot/only-dev-server',
|
2020-08-08 23:26:39 +03:00
|
|
|
'./index',
|
2018-12-22 17:20:04 +03:00
|
|
|
],
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'dist'),
|
2020-08-08 23:26:39 +03:00
|
|
|
filename: 'bundle.js',
|
2018-12-22 17:20:04 +03:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2020-09-10 18:45:02 +03:00
|
|
|
test: /\.(js|ts)x?$/,
|
2018-12-22 17:20:04 +03:00
|
|
|
use: ['babel-loader'],
|
|
|
|
exclude: /node_modules/,
|
2020-09-10 18:45:02 +03:00
|
|
|
include: __dirname,
|
2018-12-22 17:20:04 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css?$/,
|
2020-08-08 22:46:01 +03:00
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
{
|
|
|
|
loader: 'raw-loader',
|
|
|
|
options: {
|
2020-08-08 23:26:39 +03:00
|
|
|
esModule: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-09-10 18:45:02 +03:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
|
|
},
|
|
|
|
plugins: [new webpack.HotModuleReplacementPlugin()],
|
|
|
|
devServer: {
|
|
|
|
host: 'localhost',
|
|
|
|
port: process.env.PORT || 3000,
|
|
|
|
historyApiFallback: true,
|
|
|
|
hot: true,
|
|
|
|
},
|
|
|
|
devtool: 'eval-source-map',
|
2018-12-22 17:20:04 +03:00
|
|
|
};
|