-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
103 lines (100 loc) · 3.02 KB
/
webpack.dev.js
File metadata and controls
103 lines (100 loc) · 3.02 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
const webpack = require('webpack');
const webpackMerge = require('webpack-merge').merge;
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin');
const WebpackNotifierPlugin = require('webpack-notifier');
const path = require('path');
const sass = require('sass');
const utils = require('./utils.js');
const commonConfig = require('./webpack.common.js');
const ENV = 'development';
module.exports = async options =>
webpackMerge(await commonConfig({ env: ENV }), {
devtool: 'cheap-module-source-map', // https://reactjs.org/docs/cross-origin-errors.html
mode: ENV,
entry: ['./src/main/webapp/app/index'],
output: {
path: utils.root('target/classes/static/'),
filename: '[name].[contenthash:8].js',
chunkFilename: '[name].[chunkhash:8].chunk.js',
},
optimization: {
moduleIds: 'named',
},
module: {
rules: [
{
test: /\.(sa|sc|c)ss$/,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
},
{
loader: 'sass-loader',
options: { implementation: sass },
},
],
},
],
},
devServer: {
hot: true,
static: {
directory: './target/classes/static/',
},
port: 9060,
proxy: [
{
context: ['/api', '/services', '/management', '/v3/api-docs', '/h2-console', '/auth'],
target: `http${options.tls ? 's' : ''}://localhost:8080`,
secure: false,
changeOrigin: options.tls,
},
],
https: options.tls,
historyApiFallback: true,
},
stats: process.env.JHI_DISABLE_WEBPACK_LOGS ? 'none' : options.stats,
plugins: [
process.env.JHI_DISABLE_WEBPACK_LOGS
? null
: new SimpleProgressWebpackPlugin({
format: options.stats === 'minimal' ? 'compact' : 'expanded',
}),
new BrowserSyncPlugin(
{
https: options.tls,
host: 'localhost',
port: 9000,
proxy: {
target: `http${options.tls ? 's' : ''}://localhost:${options.watch ? '8080' : '9060'}`,
ws: true,
proxyOptions: {
changeOrigin: false, //pass the Host header to the backend unchanged https://github.com/Browsersync/browser-sync/issues/430
},
},
socket: {
clients: {
heartbeatTimeout: 60000,
},
},
/*
,ghostMode: { // uncomment this part to disable BrowserSync ghostMode; https://github.com/jhipster/generator-jhipster/issues/11116
clicks: false,
location: false,
forms: false,
scroll: false
} */
},
{
reload: false,
}
),
new WebpackNotifierPlugin({
title: 'School',
contentImage: path.join(__dirname, 'logo-jhipster.png'),
}),
].filter(Boolean),
});