-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
William Marques
committed
Oct 15, 2019
1 parent
7c76001
commit b38d226
Showing
7 changed files
with
130 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
generators/client/templates/angular/webpack/proxy.conf.js.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function setupProxy() { | ||
const tls = process.env.TLS; | ||
const conf = { | ||
context: ['/api', '/services', '/management', '/swagger-resources', '/v2/api-docs', '/h2-console', '/auth'], | ||
target: `http${tls ? 's' : ''}://localhost:8080`, | ||
secure: false, | ||
changeOrigin: tls | ||
}; | ||
return conf; | ||
} | ||
|
||
module.exports = setupProxy(); |
31 changes: 0 additions & 31 deletions
31
generators/client/templates/angular/webpack/webpack.custom.js
This file was deleted.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
generators/client/templates/angular/webpack/webpack.custom.js.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
const webpack = require('webpack'); | ||
const MergeJsonWebpackPlugin = require('merge-jsons-webpack-plugin'); | ||
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin'); | ||
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); | ||
const BrowserSyncPlugin = require('browser-sync-webpack-plugin'); | ||
|
||
module.exports = (config, options) => { | ||
// RULES | ||
if (config.mode === 'development') { | ||
config.module.rules.push({ | ||
test: /\.(j|t)s$/, | ||
enforce: 'pre', | ||
loader: 'eslint-loader', | ||
exclude: /node_modules/ | ||
}); | ||
} | ||
|
||
// STATS | ||
if (config.mode === 'development') { | ||
config.stats = 'minimal'; | ||
} | ||
|
||
// PLUGINS | ||
if (config.mode === 'development') { | ||
config.plugins.push( | ||
new FriendlyErrorsWebpackPlugin(), | ||
new BrowserSyncPlugin( | ||
{ | ||
https: false, | ||
host: 'localhost', | ||
port: 9000, | ||
proxy: { | ||
target: `http://localhost:4200`, | ||
proxyOptions: { | ||
changeOrigin: false //pass the Host header to the backend unchanged https://github.com/Browsersync/browser-sync/issues/430 | ||
} | ||
}, | ||
socket: { | ||
clients: { | ||
heartbeatTimeout: 60000 | ||
} | ||
} | ||
}, | ||
{ | ||
reload: false | ||
} | ||
) | ||
); | ||
|
||
if (!process.env.JHI_DISABLE_WEBPACK_LOGS) { | ||
config.plugins.push( | ||
new SimpleProgressWebpackPlugin({ | ||
format: 'compact' | ||
}) | ||
); | ||
} | ||
} | ||
|
||
config.plugins.push( | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
BUILD_TIMESTAMP: `'${new Date().getTime()}'`, | ||
// APP_VERSION is passed as an environment variable from the Gradle / Maven build tasks. | ||
VERSION: `'${process.env.hasOwnProperty('APP_VERSION') ? process.env.APP_VERSION : 'DEV'}'`, | ||
DEBUG_INFO_ENABLED: true, | ||
// The root URL for API calls, ending with a '/' - for example: `"https://www.jhipster.tech:8081/myservice/"`. | ||
// If this URL is left empty (""), then it will be relative to the current context. | ||
// If you use an API server, in `prod` mode, you will need to enable CORS | ||
// (see the `jhipster.cors` common JHipster property in the `application-*.yml` configurations) | ||
SERVER_API_URL: `''` | ||
} | ||
}), | ||
new MergeJsonWebpackPlugin({ | ||
output: { | ||
groupBy: [ | ||
{ pattern: './src/main/webapp/i18n/en/*.json', fileName: './i18n/en.json' } | ||
// jhipster-needle-i18n-language-webpack - JHipster will add/remove languages in this array | ||
] | ||
} | ||
}) | ||
); | ||
|
||
return config; | ||
}; |