This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.server.config.js
59 lines (58 loc) · 2 KB
/
webpack.server.config.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
const path = require('path');
const webpack = require('webpack');
const Dotenv = require('dotenv-webpack');
module.exports = (env) => {
let appdynamicsName = (env == 'prod' ? 'Artstor_PROD' : 'Artstor_TEST')
console.log("AppDynamics applicationName used: " + appdynamicsName)
return {
entry: { server: './server/server.ts' },
resolve: { extensions: ['.js', '.ts'] },
target: 'node',
// TO-DO: Enable "production" mode for going live with Universal
mode: 'development',
// this makes sure we include node_modules and other 3rd party libraries
externals: [
/node_modules/
],
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
},
module: {
rules: [{ test: /\.ts$/, loader: 'ts-loader' }]
},
plugins: [
new Dotenv(),
// Temporary Fix for issue: https://github.com/angular/angular/issues/11580
// for 'WARNING Critical dependency: the request of a dependency is an expression'
new webpack.ContextReplacementPlugin(
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, 'src'), // location of your src
{} // a map of your routes
),
new webpack.ContextReplacementPlugin(
/(.+)?express(\\|\/)(.+)?/,
path.join(__dirname, 'src'),
{}
),
// Attach AppDynamics code
new webpack.BannerPlugin({
raw: true,
entryOnly: true,
banner: `
require("appdynamics").profile({
controllerHostName: '${process.env.APPD_CONTROLLER_HOST_NAME}',
controllerPort: 443,
controllerSslEnabled: true, // Set to true if controllerPort is SSL
accountName: 'Ithaka', // Required for SaaS accounts
accountAccessKey: '${process.env.APPD_ACCESS_KEY}', // Required for SaaS accounts
applicationName: '${appdynamicsName}',
tierName: 'artstor-ui-ssr',
nodeName: 'artstor-ui-ssr-01',
uniqueHostId: '${process.env.SGK_INSTANCE_ID}'
});
`
})
]
}
};