-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
95 lines (84 loc) · 1.87 KB
/
Copy pathwebpack.config.js
File metadata and controls
95 lines (84 loc) · 1.87 KB
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
86
87
88
89
90
91
92
93
94
95
var webpack = require('webpack');
var path = require('path');
// array of framework/libraries that should go to vendor.build.js
var vendors = [
'angular',
'angular-ui-router',
'angularfire',
'firebase'
];
var config = {
addVendor: function (x) {
// function for adding data into vendor build
x.forEach(function(element) {
this.module.noParse.push(new RegExp(element + '\\.js$'));
// don't parse vendor's (faster build)
this.entry.vendors.push(element);
}, this);
if(x.length) this.module.noParse.push(/vendors\.bundle\.js$/);
},
resolve: {
root: path.resolve('./src')
},
debug: true,
devtool: 'eval',
entry: {
vendors: [],
app: ['webpack/hot/dev-server', __dirname + '/src/app.ts']
},
output: {
pathinfo: true,
path: '/',
publicPath: '/',
filename: '[name].bundle.js',
chunkFilename: '[id].bundle.js',
libraryTarget: 'var',
library: 'Futuun'
},
module: {
noParse: [],
loaders: [
{
test: /\.ts$/,
exclude: __dirname + '/node_modules',
loader: 'ts'
},
{
test: /\.htm$/,
loader: 'html'
},
{
test: /\.html$/,
loader: 'ngtemplate?relativeTo=' + (path.resolve(__dirname, './src')) + '/!html'
},
{
test: /\.scss$/,
loader: 'style!css!sass'
}
]
},
ts: {
// speed up compilation, use VS Code to see errors
transpileOnly: true,
silent: true
},
devServer: {
// serve files from /src to localhost:1337
contentBase: "./src",
noInfo: false,
hot: true,
port: 1337,
stats: {
colors: true
}
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin({
names: ['vendors'],
filename: '[name].bundle.js',
})
]
};
config.addVendor(vendors);
module.exports = config;