5e20ac7ed5
Merge in DNS/adguard-home from beta-client-2 to master
Squashed commit of the following:
commit b2640cc49a6c5484d730b534dcf5a8013d7fa478
Merge: 659def862 aef4659e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Dec 29 19:23:09 2020 +0300
Merge branch 'master' into beta-client-2
commit 659def8626467949c35b7a6a0c99ffafb07b4385
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Dec 29 17:25:14 2020 +0300
all: upgrade github actions node version
commit b4b8cf8dd75672e9155da5d111ac66e8f5ba1535
Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com>
Date: Tue Dec 29 16:57:14 2020 +0300
all: beta client squashed
114 lines
3.8 KiB
JavaScript
114 lines
3.8 KiB
JavaScript
const history = require('connect-history-api-fallback');
|
|
const { merge } = require('webpack-merge');
|
|
const path = require('path');
|
|
const proxy = require('http-proxy-middleware');
|
|
const Webpack = require('webpack');
|
|
|
|
const { getDevServerConfig } = require('./helpers');
|
|
const baseConfig = require('./webpack.config.base');
|
|
|
|
const target = getDevServerConfig();
|
|
|
|
const options = {
|
|
target: `http://${target.host}:${target.port}`, // target host
|
|
changeOrigin: true, // needed for virtual hosted sites
|
|
};
|
|
const apiProxy = proxy.createProxyMiddleware(options);
|
|
|
|
module.exports = merge(baseConfig, {
|
|
mode: 'development',
|
|
output: {
|
|
path: path.resolve(__dirname, '../../build2'),
|
|
filename: '[name].bundle.js',
|
|
},
|
|
optimization: {
|
|
noEmitOnErrors: true,
|
|
},
|
|
devServer: {
|
|
port: 4000,
|
|
historyApiFallback: true,
|
|
before: (app) => {
|
|
app.use('/control', apiProxy);
|
|
app.use(history({
|
|
rewrites: [
|
|
{
|
|
from: /\.(png|jpe?g|gif)$/,
|
|
to: (context) => {
|
|
const name = context.parsedUrl.pathname.split('/');
|
|
return `/images/${name[name.length - 1]}`
|
|
}
|
|
}, {
|
|
from: /\.(woff|woff2)$/,
|
|
to: (context) => {
|
|
const name = context.parsedUrl.pathname.split('/');
|
|
return `/${name[name.length - 1]}`
|
|
}
|
|
}, {
|
|
from: /\.(js|css)$/,
|
|
to: (context) => {
|
|
const name = context.parsedUrl.pathname.split('/');
|
|
return `/${name[name.length - 1]}`
|
|
}
|
|
}
|
|
],
|
|
}));
|
|
}
|
|
},
|
|
devtool: 'eval-source-map',
|
|
module: {
|
|
rules: [
|
|
{
|
|
enforce: 'pre',
|
|
test: /\.tsx?$/,
|
|
exclude: /node_modules/,
|
|
loader: 'eslint-loader',
|
|
options: {
|
|
configFile: path.resolve(__dirname, '../lint/dev.js'),
|
|
}
|
|
},
|
|
{
|
|
test: (resource) => {
|
|
return (
|
|
resource.indexOf('.pcss')+1
|
|
|| resource.indexOf('.css')+1
|
|
|| resource.indexOf('.less')+1
|
|
) && !(resource.indexOf('.module.')+1);
|
|
},
|
|
use: ['style-loader', 'css-loader', 'postcss-loader', {
|
|
loader: 'less-loader',
|
|
options: {
|
|
javascriptEnabled: true,
|
|
},
|
|
}],
|
|
},
|
|
{
|
|
test: /\.module\.p?css$/,
|
|
use: [
|
|
'style-loader',
|
|
{
|
|
loader: 'css-loader',
|
|
options: {
|
|
modules: true,
|
|
sourceMap: true,
|
|
importLoaders: 1,
|
|
modules: {
|
|
localIdentName: "[name]__[local]___[hash:base64:5]",
|
|
}
|
|
},
|
|
},
|
|
'postcss-loader',
|
|
],
|
|
exclude: /node_modules/,
|
|
},
|
|
]
|
|
},
|
|
plugins: [
|
|
new Webpack.DefinePlugin({
|
|
DEV: true,
|
|
'process.env.DEV_SERVER_PORT': JSON.stringify(3000),
|
|
}),
|
|
new Webpack.HotModuleReplacementPlugin(),
|
|
new Webpack.ProgressPlugin(),
|
|
],
|
|
});
|