This repository has been archived by the owner on Jun 21, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathwebpack.config.js
89 lines (88 loc) · 2.07 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
86
87
88
89
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: path.join(__dirname, 'static'),
entry: {
app: './app/app.ts',
common: [
"jquery",
"angular",
"angular-animate",
"angular-route",
"angular-cookies",
"angular-aria",
"hammerjs",
"moment",
"materialize.scss",
'materialize.js',
'material-design-icons.css',
'materialize-tabs.js'
]
},
output: {
path: path.join(__dirname, '/dist'),
publicPath: '',
filename: '[name]-[hash].js',
},
module: {
loaders: [
{
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.(css|less)$/,
loader: 'style-loader!css-loader',
},
{ test: /\.less$/, loader: 'less-loader' },
{ test: /\.(woff|eot|ttf|woff2)$/, loader: "file-loader" },
{ test: /\.(png|gif|ico|svg)$/, loader: "url-loader" },
{ test: /\.(html)$/, loader: "html-loader" },
{ test: /\.(json)$/, loader: "json-loader" },
{
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}
],
},
resolve: {
extensions: ['', '.ts', '.js'],
fallback: path.join(__dirname, 'node_modules'),
alias: {
'material-design-icons.css': 'material-design-icons-iconfont/dist/material-design-icons.css',
'materialize.scss': path.join(__dirname, 'static/css/materialize-customized.scss'),
'materialize.js': 'materialize-css/dist/js/materialize.js',
'materialize-tabs.js': 'materialize-css/js/tabs.js',
'jQuery': 'jquery'
}
},
resolveLoader: {
fallback: path.join(__dirname, 'node_modules')
},
devtool: "#source-map",
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
"root.jQuery": "jquery"
}),
new webpack.optimize.CommonsChunkPlugin({
name: "common",
filename: "common-[hash].js",
minChunks: Infinity
}),
new HtmlWebpackPlugin({
template: 'index.html',
inject: 'head'
})
],
devServer: {
proxy: {
"/api/*": "http://localhost:8081"
},
}
};