-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
85 lines (64 loc) · 1.8 KB
/
webpack.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
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
const webpack = require('webpack');
const path = require('path');
const webpackMerge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ngtools = require('@ngtools/webpack');
// Webpack Config
var webpackConfig = {
// context: path.join(__dirname + '/src'),
target: 'node',
entry: path.join(__dirname + '/src/server.ts'),
plugins: [
new ngtools.AotPlugin({
tsConfigPath: './tsconfig.json',
skipCodeGeneration: false,
entryModule: path.join(__dirname + '/src/app/app.node.module#AppNodeModule')
}),
new webpack.DefinePlugin({
'process.env.production': true
}),
new HtmlWebpackPlugin({
template: path.join(__dirname + '/src/index.html'),
inject: false
}),
],
module: {
loaders: [
{ test: /\.scss$/, loaders: ['raw-loader', 'sass-loader'] },
{ test: /\.css$/, loader: 'raw-loader' },
{ test: /\.html$/, loader: 'raw-loader', exclude: [path.join(__dirname, './src/index.html')] },
{
test: /\.ts$/,
loader: '@ngtools/webpack',
}
]
}
};
// Our Webpack Defaults
var defaultConfig = {
// devtool: 'source-map',
resolve: {
extensions: ['.ts', '.js'],
modules: [path.resolve(__dirname, 'node_modules')]
},
devServer: {
historyApiFallback: true,
watchOptions: { aggregateTimeout: 300, poll: 1000 }
},
output: {
path: path.resolve(__dirname, './dist/server'),
libraryTarget: 'commonjs2',
filename: 'server.js',
},
node: {
global: false,
__dirname: false,
__filename: false,
process: false,
Buffer: false,
clearImmediate: false,
setImmediate: false
}
};
module.exports = webpackMerge(defaultConfig, webpackConfig);