2018-02-22 14:39:58 +01:00
|
|
|
/*
|
|
|
|
* Development assets generation
|
|
|
|
*/
|
|
|
|
|
|
|
|
const path = require("path");
|
2018-02-05 12:11:01 +01:00
|
|
|
const autoprefixer = require('autoprefixer');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const merge = require('webpack-merge');
|
|
|
|
const common = require('./webpack.config.common.js');
|
2019-05-23 13:02:32 +02:00
|
|
|
const commonVariables = require('./webpack.configuration');
|
|
|
|
const conf = commonVariables.configuration;
|
2018-02-05 12:11:01 +01:00
|
|
|
|
|
|
|
const IP = process.env.IP || conf.HOSTNAME;
|
|
|
|
const PORT = process.env.PORT || conf.PORT;
|
|
|
|
|
|
|
|
const config = merge.strategy({
|
2019-06-08 17:54:43 +02:00
|
|
|
entry: 'prepend'
|
2018-02-05 12:11:01 +01:00
|
|
|
})(common, {
|
2019-06-08 17:54:43 +02:00
|
|
|
mode: 'development',
|
2018-02-05 12:11:01 +01:00
|
|
|
|
2019-06-08 17:54:43 +02:00
|
|
|
entry: {
|
|
|
|
app: [
|
|
|
|
'react-hot-loader/patch',
|
|
|
|
'webpack-dev-server/client?https://' + conf.HOSTNAME + ':' + conf.PORT,
|
|
|
|
'webpack/hot/only-dev-server',
|
|
|
|
]
|
|
|
|
},
|
2018-02-05 12:11:01 +01:00
|
|
|
|
2019-06-08 17:54:43 +02:00
|
|
|
output: {
|
|
|
|
path: path.join(__dirname),
|
|
|
|
filename: '[name].js',
|
|
|
|
// necessary for HMR to know where to load the hot update chunks
|
|
|
|
publicPath: 'https://' + conf.HOSTNAME + ':' + conf.PORT + '/'
|
|
|
|
},
|
2018-02-05 12:11:01 +01:00
|
|
|
|
2019-06-08 17:54:43 +02:00
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.scss$/,
|
|
|
|
use: [{
|
|
|
|
loader: 'style-loader',
|
|
|
|
options: {
|
|
|
|
sourceMap: true
|
2018-02-05 12:11:01 +01:00
|
|
|
}
|
2019-06-08 17:54:43 +02:00
|
|
|
}, {
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
sourceMap: true
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
|
|
|
plugins: [
|
|
|
|
autoprefixer({
|
|
|
|
// If we want to use the same browser list for more tools
|
|
|
|
// this list should be moved to package.json
|
|
|
|
// https://evilmartians.com/chronicles/autoprefixer-7-browserslist-2-released
|
|
|
|
browsers: [
|
|
|
|
'ie >= 11',
|
|
|
|
'ie_mob >= 11',
|
|
|
|
'Safari >= 10',
|
|
|
|
'Android >= 4.4',
|
|
|
|
'Chrome >= 44', // Retail
|
|
|
|
'Samsung >= 4'
|
|
|
|
]
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
loader: 'resolve-url-loader'
|
|
|
|
}, {
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
sourceMap: true
|
|
|
|
}
|
|
|
|
}, ]
|
|
|
|
}, {
|
|
|
|
test: /fontawesome([^.]+).(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
|
|
|
|
use: [{
|
|
|
|
loader: 'url-loader'
|
|
|
|
}]
|
|
|
|
}, {
|
|
|
|
test: /\.(gif|png|jpg|jpeg|ttf|otf|eot|svg|woff(2)?)$/,
|
|
|
|
use: [{
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name(file) {
|
|
|
|
return 'public/[path][name].[ext]';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
],
|
|
|
|
|
|
|
|
devServer: {
|
|
|
|
host: IP,
|
|
|
|
port: PORT,
|
|
|
|
historyApiFallback: true,
|
|
|
|
hot: false,
|
|
|
|
clientLogLevel: 'info',
|
|
|
|
disableHostCheck: true,
|
|
|
|
contentBase: [
|
|
|
|
path.resolve(__dirname, 'public'),
|
|
|
|
path.resolve(__dirname, 'public', 'resources'),
|
|
|
|
path.resolve(__dirname, 'public', 'resources', conf.APPDIR, conf.DIST),
|
|
|
|
'node_modules',
|
|
|
|
],
|
|
|
|
//watchContentBase: true,
|
|
|
|
overlay: {
|
|
|
|
warnings: true,
|
|
|
|
errors: true
|
2018-02-05 12:11:01 +01:00
|
|
|
},
|
2019-06-08 17:54:43 +02:00
|
|
|
headers: {
|
|
|
|
'Access-Control-Allow-Origin': '*',
|
|
|
|
}
|
|
|
|
},
|
2018-02-05 12:11:01 +01:00
|
|
|
});
|
|
|
|
|
2019-04-11 00:15:29 +02:00
|
|
|
module.exports = config;
|