-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
85 lines (81 loc) · 3.03 KB
/
Copy pathwebpack.config.js
File metadata and controls
85 lines (81 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* eslint-disable import/order,@typescript-eslint/no-var-requires */
const localConfig = require('@onedome/webpack-plugins/configs/local'),
HtmlWebPackPlugin = require('html-webpack-plugin'),
WebpackMessages = require('webpack-messages'),
FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'),
CopyPlugin = require('copy-webpack-plugin'),
merge = require('webpack-merge'),
webpack = require('webpack'),
webpackCommonSettings = require('./webpack.config.common.js'),
port = 8085;
module.exports = (params = {}, settings = {}) =>
merge(
localConfig(
{
...params,
NODE_ENV: 'development'
},
{
root: __dirname,
cdnPrefix: '',
...settings
}
),
webpackCommonSettings,
{
output: {
publicPath: '/'
},
devServer: {
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'
},
contentBase: './build/',
historyApiFallback: true,
hot: true,
quiet: true,
open: false,
port,
noInfo: false,
clientLogLevel: 'error',
proxy: {
'/api/**': {
target: 'https://web-d0a8ba30.qa.onedome.com',
// target: 'https://www.onedome.com',
changeOrigin: true,
secure: false
}
}
},
plugins: [
new HtmlWebPackPlugin({
template: './config/index.html',
filename: './index.html'
}),
new WebpackMessages({
name: 'client',
logger: str => console.log(`>> ${str}`)
}),
new FriendlyErrorsWebpackPlugin({
compilationSuccessInfo: {
messages: [`You application is running here http://localhost:${port}/hub/`]
},
onErrors: function (severity, errors) {
console.log(`severity --- `, severity);
console.log(`errors --- `, errors);
},
clearConsole: true
}),
new CopyPlugin([
{from: './config/local_env.js', to: './'},
{from: './config/images', to: './img'}
]),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin()
]
}
);
/* eslint-enable import/order,@typescript-eslint/no-var-requires */