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
|
var path = require('path');
var HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin')
var baseHref = process.env.NODE_ENV === 'build' ? '<base href="/angular/">' : '<base href="">'
var webpackConfig = {
devtool: 'source-map',
output: {
path: path.resolve('.out/angular'),
publicPath: ''
},
plugins: [
new HtmlReplaceWebpackPlugin([{
pattern: '<base href="/">',
replacement: baseHref
}])
],
module: {
rules: [
// .ts files for TypeScript
{
test: /.ts$/,
use: [
'awesome-typescript-loader',
'angular2-template-loader',
'angular2-router-loader'
]
},
{ test: /\.html$/, loader: "html-loader" },
{
test: /.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
include: path.resolve(__dirname, '../')
},
]
},
resolve: {
extensions: ['.ts', '.js'],
modules: [path.resolve(__dirname, 'node_modules')],
alias: {
root: path.resolve(__dirname),
app: path.resolve(__dirname, 'src')
}
},
node: {
global: true,
crypto: 'empty',
__dirname: true,
__filename: true,
process: true,
Buffer: false,
clearImmediate: false,
setImmediate: false
}
};
module.exports = webpackConfig;
|