2018-10-31 00:25:29 +03:00
const path = require ( 'path' ) ;
2018-09-25 17:39:21 +03:00
const webpack = require ( 'webpack' ) ;
2018-10-24 23:50:08 +03:00
2019-01-02 08:31:10 +03:00
const TARGET _PORT = process . env . TARGET _PORT || 8043 ;
const TARGET _HOST = process . env . TARGET _HOST || 'localhost' ;
const TARGET = ` https:// ${ TARGET _HOST } : ${ TARGET _PORT } ` ;
2018-09-25 17:39:21 +03:00
2019-06-19 18:38:28 +03:00
const ROOT _PATH = _ _dirname ;
const SRC _PATH = path . join ( ROOT _PATH , 'src' ) ;
2018-09-25 17:39:21 +03:00
module . exports = {
2018-10-25 04:55:59 +03:00
entry : './src/index.jsx' ,
2018-09-25 17:39:21 +03:00
module : {
rules : [
{
test : /\.(js|jsx)$/ ,
exclude : /node_modules/ ,
2018-10-31 00:25:29 +03:00
loader : 'babel-loader'
2018-10-11 18:31:37 +03:00
} ,
{
test : /\.s?[ac]ss$/ ,
use : [
{ loader : 'style-loader' } ,
{ loader : 'css-loader' } ,
2018-10-15 19:15:26 +03:00
{ loader : 'sass-loader' } ,
]
} ,
{
test : /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/ ,
use : [ {
2018-10-31 00:25:29 +03:00
loader : 'file-loader' ,
options : {
name : '[name].[ext]' ,
outputPath : 'assets/fonts/' ,
2018-11-16 08:13:25 +03:00
publicPath : 'assets/fonts' ,
2018-10-31 00:25:29 +03:00
includePaths : [
2019-02-18 05:51:02 +03:00
'node_modules/@patternfly/patternfly/assets/fonts' ,
2018-10-31 00:25:29 +03:00
]
}
2018-10-15 19:15:26 +03:00
} ]
2018-10-11 18:31:37 +03:00
} ,
{
2018-10-15 19:15:26 +03:00
test : /\.(jpg|png|gif|svg)(\?v=\d+\.\d+\.\d+)?$/ ,
2018-10-11 18:31:37 +03:00
use : [ {
2018-10-31 00:25:29 +03:00
loader : 'file-loader' ,
options : {
name : '[name].[ext]' ,
outputPath : 'assets/images/' ,
2018-11-16 08:13:25 +03:00
publicPath : 'assets/images' ,
2018-10-31 00:25:29 +03:00
includePaths : [
2019-02-18 05:51:02 +03:00
'node_modules/@patternfly/patternfly/assets/images' ,
2018-10-31 00:25:29 +03:00
]
}
2018-10-11 18:31:37 +03:00
} ]
2018-09-25 17:39:21 +03:00
}
]
} ,
resolve : {
2019-06-19 18:38:28 +03:00
extensions : [ '*' , '.js' , '.jsx' , '.css' ] ,
alias : {
'@api' : path . join ( SRC _PATH , 'api' ) ,
'@components' : path . join ( SRC _PATH , 'components' ) ,
'@contexts' : path . join ( SRC _PATH , 'contexts' ) ,
'@screens' : path . join ( SRC _PATH , 'screens' ) ,
'@types' : path . join ( SRC _PATH , 'types' ) ,
'@util' : path . join ( SRC _PATH , 'util' ) ,
'@testUtils' : path . join ( ROOT _PATH , 'testUtils' ) ,
}
2018-09-25 17:39:21 +03:00
} ,
output : {
2018-10-31 00:25:29 +03:00
path : path . resolve ( _ _dirname , '/dist' ) ,
2018-09-25 17:39:21 +03:00
publicPath : '/' ,
filename : 'bundle.js'
} ,
plugins : [
new webpack . HotModuleReplacementPlugin ( )
] ,
devServer : {
contentBase : './dist' ,
hot : true ,
inline : true ,
stats : 'minimal' ,
host : '127.0.0.1' ,
https : true ,
2018-09-27 01:11:29 +03:00
port : 3001 ,
2018-09-25 17:39:21 +03:00
clientLogLevel : 'none' ,
proxy : [
2018-10-31 00:25:29 +03:00
{
2018-09-25 17:39:21 +03:00
context : '/api/login/' ,
target : TARGET ,
secure : false ,
ws : false ,
headers : {
2018-10-31 00:25:29 +03:00
Host : ` localhost: ${ TARGET _PORT } ` ,
Origin : TARGET ,
Referer : ` ${ TARGET } / `
2018-09-25 17:39:21 +03:00
}
2018-10-31 00:25:29 +03:00
} ,
{
2018-09-25 17:39:21 +03:00
context : '/api' ,
target : TARGET ,
secure : false ,
ws : false ,
bypass : req => ( req . originalUrl . includes ( 'hot-update.json' ) || req . originalUrl . includes ( 'login' ) ) ,
2018-10-31 00:25:29 +03:00
} ,
{
2018-09-25 17:39:21 +03:00
context : '/websocket' ,
target : TARGET ,
secure : false ,
ws : true
2018-10-31 00:25:29 +03:00
}
]
2018-12-10 18:16:52 +03:00
} ,
// https://github.com/lingui/js-lingui/issues/408
node : {
fs : 'empty'
2018-09-25 17:39:21 +03:00
}
} ;