forked from jhipster/generator-jhipster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_webpack.dev.js
74 lines (72 loc) · 2.35 KB
/
_webpack.dev.js
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
const webpack = require('webpack');
const path = require('path');
const commonConfig = require('./webpack.common.js');
const writeFilePlugin = require('write-file-webpack-plugin');
const webpackMerge = require('webpack-merge');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const ENV = 'dev';
const execSync = require('child_process').execSync;
const fs = require('fs');
const ddlPath = './<%= BUILD_DIR %>www/vendor.json';
if (!fs.existsSync(ddlPath)) {
execSync('webpack --config webpack/webpack.vendor.js');
}
module.exports = webpackMerge(commonConfig({ env: ENV }), {
devtool: 'inline-source-map',
devServer: {
contentBase: './<%= BUILD_DIR %>www',
proxy: [{
context: [<% if (authenticationType === 'oauth2') { %>
'/oauth',<% } %><% if (authenticationType === 'uaa') { %>
'/uaa',<% } %>
'/api',
'/management',
'/swagger-resources',
'/v2/api-docs',
'/h2-console'
],
target: 'http://127.0.0.1:<%= serverPort %>',
secure: false
}<% if (websocket === 'spring-websocket') { %>,{
context: [
'/websocket'
],
target: 'ws://127.0.0.1:<%= serverPort %>',
ws: true
}<% } %>]
},
output: {
path: path.resolve('<%= BUILD_DIR %>www'),
filename: '[name].bundle.js',
chunkFilename: '[id].chunk.js'
},
module: {
rules: [{
test: /\.ts$/,
loaders: [
'tslint-loader'
],
exclude: ['node_modules', new RegExp('reflect-metadata\\' + path.sep + 'Reflect\\.ts')]
}]
},
plugins: [
new BrowserSyncPlugin({
host: 'localhost',
port: 9000,
proxy: {
target: 'http://localhost:9060'<% if (websocket === 'spring-websocket') { %>,
ws: true<% } %>
}
}, {
reload: false
}),
new ExtractTextPlugin('styles.css'),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin(),
new writeFilePlugin(),
new webpack.WatchIgnorePlugin([
path.resolve('./src/test'),
])
]
});